~/talk

Optimizing your app by understanding your PostgreSQL database

Talkat RailsConf 2019 · 2019-05-01..05-03· [databases, ruby-on-rails]
slides:none on file

Uses Postgres internals and concrete queries to find why an app is slow: check buffer cache hit ratio (aim for >95–99%), inspect bloat and autovacuum (recommend autovacuum at ~2% for large tables), and identify unused indexes. Run pg_stat_statements, query pg_stat_user_tables and index stats, then use EXPLAIN ANALYZE and multi‑column CREATE STATISTICS to fix misestimates (one user sees ~1000× speedup). Mentions tools for IO counts, tuple counts, and practical tuning steps; sponsored by Citus Data.

AI-written summary · about

  1. 0:00Start
  2. 2:39Challenge: Relating issues to the database
  3. 3:15Solution: Using Postgres' statistics
  4. 4:51Problem: My application is slow
  5. 5:24Cache hit ratio
  6. 6:22How do I measure?
  7. 8:38Digging further
  8. 18:30Uses for pg_stat_user_tables
  9. 21:35Back to cache hit rate
  10. 23:07Generic vs specific optimizations
  11. 23:54What is pg_stat_statements ?
  12. 25:40Examples
  13. 28:31EXPLAIN ANALYZE and tune them!
  14. 30:02Interesting things about EXPLAIN
  15. 33:28CREATE STATISTICS
  16. 34:03Example of impact
  17. 34:40Summary of specific query optimization
  18. 38:11Approximate count
~/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.