Code RoomSearch timeout with type mismatch
MediumPrep Room Coding #4672

Search timeout with type mismatch

On-callDatabases & SQLMid–Senior~30 min

A search endpoint that filters customers by a phone-number field started timing out after a deploy that 'just changed a query.' `EXPLAIN ANALYZE` shows a sequential scan over the 50M-row `customers` table even though there's a btree index on `phone`. The column is `varchar` but the new code passes the parameter as an integer (`bigint`). Older queries on the same column are still fast and use the index. CPU climbs whenever the endpoint is hit. 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.