composite index column order matters, query still slow
Postgres 15. I have a composite index on (a, b) but a query filtering only on b is slow and EXPLAIN shows no index use:
Seq Scan on t (cost=0.00..5000.00 rows=1 width=32) (actual time=0.01..45.0 rows=1 loops=1)
Filter: (b = 99)
I thought having b in the index was enough. Why isn't it used? Been going in circles on this for a day.
4 replies