~/talk

Optimize Python & Django apps with Postgres superpowers

Talkat PyCon US 2020 · 2020-04-15..04-23· [databases, django]
slides:none on file

Shows exact fixes and measurements: use pg_stat_statements and Postgres logs to find offenders, cut 101 queries down to 6 with prefetch_related and limiting columns with only, avoid 96 per-page queries that explode with 1,000,000 rows, replace offset/limit with keyset pagination to halve DB time (1.2s → 628ms in the demo), add a partial index to remove sequential scans, and scale out with Hyperscale (Citus) when a single node maxes out.

AI-written summary · about

  1. 0:00Intro
  2. 5:49pg_stat_statements / analyzing performance
  3. 6:29Query Performance Insights / on Azure
  4. 7:01Performance Recommendations / on Azure
  5. 8:59Logs on Postgres / are they useful?
  6. 14:33Loops, once upon a thousand times
  7. 16:37CATCHING LOOPS ON PROD
  8. 18:11Limiting what you are selecting
  9. 21:17Pagination / why is paginating so important?
  10. 22:14Pagination / Default paginator class
  11. 27:50Keyset pagination / why you should care
  12. 31:44Fixing a slow query / Looking into EXPLAIN
  13. 33:01Fixing a slow query / adding a partial index
  14. 34:51Fixing a slow query / scaling UP your server
  15. 39:28Your 8 takeaways, the Postgres superpowers
~/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.