
How to Make a Slow PostgreSQL Query Fast at 1 Million Rows
Your query is not slow. It has just never met enough data to be slow. Here is how to take a query from 28 ms to 0.075 ms on a table of 1 million rows, using EXPLAIN ANALYZE, one composite index, and keyset pagination, with every number reproduced on a real database.
Solomon Eseme
8/27/2026










