Skip navigation

random_page_cost in Postgres - why the default is 4.0 and should you lower it?

Tomas Vondra

Tomas Vondra Tomas Vondra

(Livestream 1)

random_page_cost is one of the basic parameters affecting query planning in PostgreSQL. It expresses the cost of random I/O in relation to sequential reads. The lower the value, the "cheaper" the operations performing random I/O – typically Index Scans. Since 2002 the default value is set to 4.0, but how did we pick it and why didn't it change over the ~25 years? The storage changed a lot over the years. And should you reduce it when running on SSDs?

talk bubbles
Join the conversation

Use the hashtag #PosetteConf