I
I
impressive172021-11-30 22:26:09
PostgreSQL
impressive17, 2021-11-30 22:26:09

What index to choose for a range of dates?

Have a request

SELECT *
FROM table
WHERE id > 100
AND date >= ДАТА
AND date <  ДАТА
ORDER BY id
LIMIT 1000

What are the correct indexes to make it work quickly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ky0, 2021-11-30
@ky0

It is quite possible to get by with partitioning tables by date, then the standard btree should work quite quickly.
https://postgrespro.ru/docs/postgresql/14/ddl-part...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question