~/talk

Identifying Slow Queries and Fixing Them!

Talkat PGConf NYC 2021 · 2021-12-02..12-03· [databases]
links:none on file
slides:none on file

PostgreSQL logging and stats expose concrete fixes: enable log_min_duration_statement (zero logs every statement, or use log_min_duration_sample with a sample rate), parse logs with pg_badger, and inspect active queries with pg_stat_statements. EXPLAIN/ANALYZE and auto_explain reveal plans — e.g. a PG_SLEEP shows ~1001 ms, a big external sort costs ~1.4 s, a seq scan reads ~30,000 rows to return 234. Raise work_mem, tune checkpoints/max_wal_size, VACUUM visibility map, use pg_bloat_check and review pg_stat_user_indexes.

AI-written summary · about

  1. 0:00Start
  2. 6:22log checkpoints
  3. 20:01PostgreSQL Configuration
  4. 22:21Dead Tuples / Bloat
  5. 30:58Fixing Slow Queries
~/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.