Lower the Random Page Cost on SSDs So Index Scans Stop Looking Expensive
The planner compares plans using made-up cost units, and its default says a random page read costs four times a sequential one — a ratio taken from spinning disks. On SSDs and cloud volumes the real gap is far smaller, so the default quietly biases the planner towards sequential scans and away from correct index plans. Setting random_page_cost to around 1.1, alongside an effective_cache_size that reflects real memory, is the one cost setting most production databases should change.
Questions this Concept answers
Why does leaving `random_page_cost` at 4.0 on SSD storage bias plan choice?
J
jeremy
Video
Why the random_page_cost Default Is 4.0 and When to Lower It in PostgreSQL
`random_page_cost` is a PostgreSQL planner parameter expressing the estimated cost of fetching one 8 KB page by random access, denominated in units of `seq_page_cost` (fixed at 1.0), so the cost-base…