williamdclt
03/15/2022, 7:09 PM1.4.0
. The index does exist, but indeed isn't used: PG has to choose whether to use the index on id
(to speed up one of MIN
or MAX
), or the index on timestamp
to speed up the filtering.
Adding this index seems to solve it, at least in the query plan:
CREATE INDEX CONCURRENTLY rttx_timestamp_id ON relation_tuple_transaction(id, "timestamp");