tutorials27 min read
Every Query 0.04 ms, the Page Half a Second: the N+1 Query Pattern and the Cost of a Network Round Trip
The mobile app's new My Orders screen takes half a second; the database is relaxed, the API is idle and every query runs in under 0.1 ms. From the staircase-shaped trace in Jaeger we follow, step by step, the N+1 query pattern, why latency grows linearly with the number of queries, and how the fix brings it down to three fixed queries.