benchmarkQuery
benchmarkQueryMeasure repeatable query latency with cold runs and min/median/max warm-run timings to compare query rewrites without retrieving data.
Instructions
Measure repeatable query latency with separate cold runs and min/median/max warm-run timings. Use for comparing query rewrites, not retrieving data; timedQuery is the one-run alternative that returns rows. Bind '?'->params, ':name'->namedParams; never mix. E.g. :status -> namedParams={status:'PAID'} — key is the bare name. Returns the size of the last result (rows, columns, truncated), not the rows.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | ||
| limit | Yes | Row limit per run (> 0). | |
| params | No | Values for '?' placeholders, in order. | |
| coldRuns | No | Cold runs (default 1); executed first. | |
| warmRuns | No | Warm runs (default 3). | |
| connection | Yes | Database to run against. Call listConnections for valid names; do not guess. | |
| namedParams | No | Values for ':name' placeholders, keyed by name. | |
| timeoutSeconds | Yes | Timeout per run in seconds (> 0). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | Additional context about support, limits, interpretation, or engine-specific behavior. | |
| runs | Yes | Number of measured runs included in these timing statistics. | |
| allMs | No | Individual elapsed times for all benchmark executions, in milliseconds. | |
| limit | Yes | Row limit applied to the query or page size requested by the caller. | |
| coldMs | No | Timing statistics for cold benchmark runs in milliseconds. | |
| engine | No | Database engine that produced the result, such as PostgreSQL, Oracle, or SQL Server. | |
| warmMs | No | Timing statistics for warm benchmark runs in milliseconds. | |
| coldRuns | Yes | Number of cold runs executed before warm measurements. | |
| warmRuns | Yes | Number of warm runs used for the primary benchmark statistics. | |
| resultSize | No | ||
| timeoutSeconds | Yes | Per-statement timeout applied during execution, in seconds. |