~/talk

How to Make Your Backend Roar

Talkat PyCon Israel 2024 · on Monday, 2024-09-16· [databases, python]
slides:none on file

Builds a Django URL shortener and benchmarks PostgreSQL index strategies on a million rows: plain SELECT by key uses a B-tree index; switching to a covering index (INCLUDE) yields an index-only scan and cuts I/O. Finding zero-hit rows uses a partial index that shrinks index size from ~7 MB to ~88 KB and speeds queries. Reverse lookup on URL compares B-tree (47 MB, ~12 ms) vs hash index (32 MB, ~0.07 ms) showing hash can be both smaller and faster for mostly-unique text keys.

AI-written summary · about

  1. 0:00Introduction
  2. 1:37What is URL Shortener
  3. 3:03Creating short URLs table
  4. 4:50Execution Plan explained
  5. 6:18First scenario: URL lookup
  6. 7:24How B-Tree index works
  7. 8:51Improving queries with Covering index
  8. 12:35Covering indexes benefits
  9. 12:59Second scenario: finding unused URLs
  10. 14:45What are performance
  11. 15:47Index size impact
  12. 16:52What is Partial index
  13. 17:15Creating Partial index
  14. 18:42Partial index use cases
  15. 19:29Third scenario: Reverse Lookup
  16. 20:59Hash indexes benefits
  17. 22:27How Hash index works
  18. 24:41Creating Hash index
  19. 25:46B-Tree vs Hash comparison
  20. 28:46Hash indexes pros and cons
  21. 30:36Hash indexes limitations
  22. 31:19Indexes summary and importance
~/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.