Query to find all timestamps more than a certain interval apart
问题 I'm using postgres to run some analytics on user activity. I have a table of all requests(pageviews) made by every user and the timestamp of the request, and I'm trying to find the number of distinct sessions for every user. For the sake of simplicity, I'm considering every set of requests an hour or more apart from others as a distinct session. The data looks something like this: id| request_time| user_id 1 2014-01-12 08:57:16.725533 1233 2 2014-01-12 08:57:20.944193 1234 3 2014-01-12 09:15