Code RoomPostgres replica CPU spike from unoptimized query
MediumPrep Room Coding #4655

Postgres replica CPU spike from unoptimized query

On-callDatabases & SQLMid–Senior~30 min

At 12:40 your reporting service's Postgres read replica spikes to 100% CPU and stays there; every query on that replica times out. pg_stat_activity shows one query running for 14 minutes that the app never normally runs that long: a user-built ad-hoc report joining three large tables with a LIKE '%...%' free-text filter and no LIMIT, generated by a new self-serve report builder shipped this morning. The same query keeps reappearing because the user keeps hitting 'retry' after each timeout. How do you triage and mitigate?

What a strong answer looks like

Stop the bleeding first (mitigate), then form hypotheses from real signals. Separate root cause from symptom, communicate status as you go, and close with what prevents a repeat.

0:00 of about 30 min
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.