~/talk

Profiling Postgres Perils

Talkat PGConf.dev 2026 · 2026-05-19..05-22· [databases]
slides:none on file

Practical pitfalls and concrete fixes for profiling Postgres: hardware counters can be invisible in VMs so perf falls back to millisecond timers and gives a different profile; CPU boosting shifts first-run vs later-run throughput (observed up to ~2x clocks) so disable turbo boost for reproducibility; SSD write throughput collapses after a few seconds on consumer drives (one model drops after ~8s, another holds ~70s) so fstrim or over‑provisioning helps; instruction TLB behavior and 2MB alignment of code sections cuts ITLB misses and yields ~5–10% speedups; use perf stat -D DDD, off‑CPU/BPF tools, pin to one core and disable deep idle states to get repeatable results.

AI-written summary · about

  1. 0:00Introduction to Postgres profiling
  2. 1:08Why you profile and reproducibility
  3. 2:09How performance counters work
  4. 4:38CPU-bound vs non-CPU-bound workloads
  5. 6:02Off-CPU profiling tools
  6. 7:06Memory latency vs CPU cycles
  7. 9:17Profiling in virtualized environments
  8. 12:06CPU boosting and thermal throttling
  9. 15:39Disabling turbo boost
  10. 18:48Turbo boost impact on bottlenecks
  11. 19:09SSD write performance degradation
  12. 21:15Over-provisioning and trimming SSDs
  13. 22:17Benchmark duration and reproducibility
  14. 23:03I/O measurement with iostat
  15. 23:24CPU core speed variations
  16. 24:08Limiting CPU cores for consistency
  17. 24:50CPU idle states and performance
  18. 27:40Disabling CPU idle states
  19. 29:29Batching to avoid idle states
  20. 30:53Choosing correct benchmarks
  21. 31:57Maximizing bottleneck workload proportion
  22. 34:05Why small improvements are hard to measure
  23. 36:10Huge pages and ITLB misses
  24. 38:57Huge page alignment in Postgres
  25. 41:06Uncontrollable huge page allocation
  26. 42:30Read-only THP and performance
  27. 43:11Workaround for huge page variations
  28. 44:12Analyzing perf reports top-down and bottom-up
  29. 45:37CPU frequency scaling and code speed
  30. 46:22Disabling power states for consistency
  31. 46:42Automation and shell scripts
  32. 48:05Link time optimization impact
  33. 49:09Perf vs eBPF tools
  34. 50:11Hyper-threading considerations
  35. 51:15Top-down analysis with PMU tools
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 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
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
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.