~/talk

pg_stat_advisor: Optimizing PostgreSQL Planner with Insights

Talkat FOSSASIA PGDay 2025 · on Friday, 2025-03-14· at 14:00· Hall 2· [databases]
slides:none on file

An extension called pg_stat_advisor watches query estimates (via EXPLAIN ANALYZE), records mismatches into a memory ring buffer, and a background worker every ~10s auto-creates extended statistics when estimated vs actual row counts exceed a configurable 100x threshold (example: 10 million-row table where extended stats bring estimates to reality). It requires ANALYZE first and shared_preload_libraries restart, skips partitions/temp tables/joins, and can bloat ANALYZE so pruning useless stats is a planned improvement.

AI-written summary · about

  1. 0:00Introduction and speaker intro
  2. 1:10Talk overview and goals
  3. 2:36Planner statistics issues and examples
  4. 7:40Extension pg_stat_advisor features
  5. 8:23How pg_stat_advisor works internally
  6. 12:03Configuration and parameters
  7. 13:26Example with analyze command
  8. 14:34Limitations and restrictions
  9. 17:51Future plans for the extension
  10. 21:05Q&A session begins
  11. 21:27PostgreSQL statistics size comparison
  12. 22:50Join node statistics analysis
  13. 25:24Statistics collection criteria
  14. 26:49Explain vs select command data
  15. 28:14Extension installation and restart
  16. 30:03Final Q&A and conclusion
~/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.