beginner

Eighty-Seven Fast Queries

Read the evidence before you read the options. The signals are presented the way a dashboard would present them — nothing is labelled with the answer.

The report

The team lead noticed that the order history page takes about two seconds to load and asked someone to "look at the database". The database team reports that every query on that endpoint runs in single-digit milliseconds and there are no slow queries logged at all.

GET /orders/history — endpoint dashboardILLUSTRATIVE
SignalValueWhat it tells you
p95 latency2.1 sThe page takes about two seconds at the tail.
App CPU17%The application is not compute-constrained.
Slowest single query4 msNo individual query is slow.
DB CPU38%The database has spare capacity.
Queries per request88 averageEach page load issues eighty-eight separate queries.
Connection pool wait2 msConnections are available on demand.
Round-trip time to DB21 msEach query costs about twenty-one milliseconds in network time alone.
One request, spans collapsed where identical
critical pathILLUSTRATIVE
0510102015302040
GET /orders/history2040 ms
auth.verify6 ms
SELECT * FROM orders WHERE user_id = $124 ms
SELECT * FROM order_items WHERE order_id = $1×871960 ms
serialize response40 ms
SELECT * FROM orders WHERE user_id = $1Returns 87 rows
SELECT * FROM order_items WHERE order_id = $187 sequential executions, ~22 ms each
What is the constraint?