SQL statements, values and compare
The Database view of a snapshot lists the SQL statements your services ran, with how often, how fast and how many rows each touched, and which values were passed to it. It can also compare the SQL of two snapshots or replay reports. It runs the same analysis as proxymock web, so the same recording gives the same statements in both.
Open a snapshot's Traffic tab, then choose Database.
List the statements
Choose Statements at the top of the view. The summary counts unique statements, recorded queries, tables, services, hosts and protocols. Rank statements by orders the list:
- Busiest: by how many times each statement ran.
- Slowest: by p95 latency across every recorded execution.
- Most rows: by the average rows a call returned or changed.
Click a statement for its full stats: protocol, tables, services and hosts, minimum, average, p95 and maximum latency, rows, and how often each route ran it. In the Tables view, each statement that matches the inventory shows its p95, average and rows on one line.
See the values passed to a statement
Values shows, for each parameter or literal position, how many distinct values it took and, for each value, how many calls used it, the total and p95 time, its share of the calls and its errors. A value that dominates one position, or one slow value, often explains a slow statement. Values are kept for the 200 busiest statements.
Filter to one statement shape
Filter to this shape opens the outbound Requests list filtered to every call of that statement, with any values, so you can open the calls themselves. See Find statements with filters for the other database filters.
Compare the SQL of two recordings
Compare SQL with... is on the Database view of a snapshot and on the Performance tab of a report. From a snapshot, compare with A replay of this snapshot or Another snapshot. From a report, compare with This report's recording, Another report of the snapshot or Another snapshot. The recording is the baseline by default, and Swap sides changes it. Every change is the candidate minus the baseline.
What changed lists the findings first, for example an UPDATE or DELETE that lost its WHERE clause and now affects every row, a new query that runs once per row (a possible N+1), or a schema migration that ran on one side only. Below it:
- Statements: the statements that are new, changed, removed or present on both sides. A changed statement shows what was added and removed, and WHERE dropped marks one that lost its filter.
- Performance: p95 regressions, count changes per 1,000 queries, database time by table, and statements per request by endpoint. Latency changes count only when each side has at least five timed calls.
- Tables and schema: migrations with the side they ran on, the operations each table saw on each side, and columns that appeared or disappeared.
Keep in mind
A snapshot or report analyzed before the SQL inventory existed shows a note; reanalyze the snapshot or replay again. Each inventory reads up to the first 1,000,000 statements and inbound requests and says so when it stops early.