Why did my Postgres index stop being used after adding ORDER BY created_at DESC?
Postgres 16, table with about 4 million rows. A query filtering on tenant_id used the index on that column until I added ORDER BY created_at DESC LIMIT 20. Now it does a sequential scan and sort. There is a separate index on created_at. Why did the planner change its mind?
4 replies