~/talk

The 8-Second Nightmare: How One Change Reduced Latency by 99.9%

Talkat Friendly.rb 2024 · 2024-09-18..09-19· [databases, web-performance]
links:none on file
slides:none on file

A slow aggregation on millions of shift rows proves to be an indexing problem spotted in DataDog logs and inspected with EXPLAIN ANALYZE and SHOW INDEXES the query scans 3.3 million rows and takes ~9.45s because composite indexes never get used due to column order and missing prefiltering. Adding a scope to filter by employer_id and reordering the query to match the composite index (employee_id then reference_date) drops runtime to 0.003s — a 99.9% reduction and thousands fewer rows scanned.

AI-written summary · about

  1. 0:00Introduction
  2. 1:03The 8-second nightmare
  3. 10:01Investigating slow queries
  4. 20:33Understanding query costs
  5. 24:32Root cause analysis
  6. 26:20Implementing the fix
  7. 28:50Results and learnings
~/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.