~/talk

How to confirm that the index you added actually improves query performance

Talkat PyCon AU 2024 · 2024-11-22..11-26· [databases, django]
links:none on file
slides:none on file

Automatic btree index on a text field does not get used because Django ORM emits LIKE with leading and trailing wildcards so the planner chooses a parallel sequential scan even on a representative sample with 100,000 rows filtered. Replacing the btree with a gin trigram op class drops a node cost from about 81,000 to 235 and produces a bitmap index scan. Fixing case insensitive searches requires an index built with upper(...) so the index actually gets used.

AI-written summary · about

  1. 0:00Confirming index performance impact
  2. 1:54PostgreSQL storage internals
  3. 5:48Sequential vs index scans
  4. 9:36B-tree indexes limitations
  5. 13:30Why indexes aren’t used
  6. 17:25Non-working LIKE index in Django
  7. 20:36GIN indexes for partial matching
  8. 23:04Case-insensitive partial matching
  9. 25:54Index selection summary
~/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.