~/talk

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

slides:none on file

Recreates the original 2000s experiment: large uniform tables, forcing index vs sequential scans, and measuring per-page timings with direct I/O and EXPLAIN ANALYZE. Finds raw random/sequential ratios far above the 4.0 default—estimated random_page_cost 27–140 across SSDs and spinning disks—so the default is not simply the raw I/O ratio. Raising cost to match raw numbers may help isolated queries but increases cache pressure and hurts overall concurrency, so tuning needs measured system-wide monitoring rather than a single-number benchmark.

AI-written summary · about

  1. 0:00Music & introduction
  2. 0:28Agenda and key questions to answer
  3. 0:45How Postgres cost-based planning works
  4. 2:05Sequential vs random I/O explained
  5. 3:40Breaking down cost formulas and parameters
  6. 7:50Where the default value 4.0 comes from
  7. 10:40Re-running old experiments on modern hardware
  8. 13:20Measuring real I/O costs with explain analyze
  9. 15:35Surprising results from SSDs and spinning disks
  10. 18:25Why higher costs can hurt overall performance
  11. 22:37Should you lower random_page_cost?
  12. 24:10Practical tuning advice and trade-offs
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.