It Worked in Dev. It Worked in QA. Then Production Happened.
A backend engineer shares a production incident where an appointment-fetching endpoint worked fine in dev and QA but caused 4-second response times in production. The issue was an N+1 query problem: the code made 6,000+ individual database calls to fetch patient details. The solution involved batching patient data retrieval into a single query using in-memory maps and adding proper projections, reducing latency to 500-600ms. The incident highlights the importance of testing with realistic data volumes, thorough code reviews, and anticipating edge cases during development.