Sample Header Ad - 728x90

How to efficiently (O(log n)) get the sum over a range (date/time range) of a column?

0 votes
1 answer
80 views
One column is value in integer. Second column is timestamp in datetime. I want to efficiently get the sum of the values in the first column over a datetime range (start time to end time). Is there some way to tell postgres to maintain a range query segment tree over one column. Also imagine if the table had another column called userId. My queries would look 'give me the sum total over a date range for this userid'.
Asked by Kuelf Deez (101 rep)
May 21, 2024, 08:08 AM
Last activity: May 21, 2024, 08:37 AM