Skip to content
Advertisement

Tag: timespan

Get distinct values within time chunks

I have a table with different species and their occurences (timestamp) from field survey: Now I want to count them, not in total but in chunks of 10 minutes each, where only the first occurence is counted. That means between 12:31 and 12:40 there are species A,B,C. Between 12:41 and 12:50 there are species B,C. For a single 10 minute

How to get maximum number of concurrent events in postgresql?

I have a table named events like this: These events could have overlaps, and I want to know maximum number of overlapping events that have occurred over a time span. For example, in a situation like this: The answer is 2, because at most 2 events overlap at 10:30 until 10:35. I’m using Postgres 9.6 Answer Here is the idea:

Advertisement