TGViewer
Computer Science and Programming Computer Science and Programming @computer_science_and_programming · 140K subscribers
Post #2170 11.4K
The real cost of random I/O
PostgreSQL's `random_page_cost` has been set to 4.0 by default for ~25 years, but experiments on modern SSDs show the actual cost ratio of random vs. sequential I/O is closer to 25-35x, not 4x. This means the planner picks suboptimal plans (sequential scan instead of index scan) for selectivities between 0.2% and 2.2%. Settingindex scan) for seleto ~30 aligns cost estimates with actual durations. However, lowering the value can still be justified in OLTP workloads with high cache hit rates, where random I/O avoids expensive full table scans. A complicating factor is that prefetching (which benefits sequential and bitmap scans but not index scans) interacts withties between 0.2% anin non-obvious ways, and the current cost model ignores prefetching entirely. Proposed improvements include separating non-I/O costs fromshow the actual cost better cache statistics, and incorporating prefetching into the cost model.
  • ❤ 10
  • 👍 2
  • 🔥 1
More from @computer_science_and_programming
  1. Oct 3, 2026BYD says it will have a solid-state car next year, the earliest date anyone has given BYD…
  2. Oct 1, 2026Introducing G#: A Go-like language for .NET G# is a new open-source, Go-inspired programmi…
  3. Sep 30, 2026Chrome for Developers Chrome 146 introduces three notable features for web developers. Scr…
  4. Sep 26, 2026Introduction to Solon A comprehensive tutorial walks through building a REST API with Solo…
  5. Sep 25, 2026The strangler fig pattern: modernizing without a big-bang rewrite A detailed guide to the…
  6. Sep 24, 2026Lessons From Four Years of Writing a Weekly Newsletter A .NET blogger reflects on four yea…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →