Can I use r-tree indexes to find MAX(), MIN() values in arbitrary intervals quickly?
0
votes
0
answers
22
views
As far I can see, r-tree indexes are used today mostly for geographic systems, for spatial searches.
I need some very similar, but not in space, but in 1-D time series.
Imagine a *huge* time series, for example floating point data of a billions of point.
*I need to answer quickly questions like*
> *"what was the maximal value in the interval (1345223, 23234235)"?*
Note, the DB is huge, a simple
SELECT MAX(value) WHERE id BETWEEN 1345223 AND 23234235
is not acceptable - at least not if it needs a linear scanning of the interval. It must happen in same type of tricky index, most likely r-tree.
Maybe it helps (but more likely not): as it is a time series table, it is inherently single-column.
Other index types or other database engines are okay as well. I am investigating postgresql only because it is the smartest open source engine I know.
Asked by peterh
(2137 rep)
May 9, 2025, 06:07 PM