Query Benchmarking
Benchmark queries by running them multiple times and collecting timing stats
Query Benchmarking
Run a query multiple times to collect accurate performance statistics, eliminating variance from single-run measurements.
A single run tells you almost nothing: a cold cache, a background checkpoint, or a noisy neighbor can make the same query look 10× slower than it really is. Benchmarking runs it many times and reports the distribution, so “is this actually faster?” gets a trustworthy answer instead of a coin flip. It’s the tool you reach for when deciding whether an index or a rewrite really helped — not just whether it happened to be quick once.
Running a Benchmark
- Write your query in the editor
- Click the Benchmark button in the toolbar (stopwatch icon)
- Select the number of iterations:
| Iterations | Use Case |
|---|---|
| 10 | Quick check |
| 50 | Moderate confidence |
| 100 | High confidence |
| 500 | Detailed profiling |
- The benchmark runs and collects timing data for each iteration
Results
After completion, you see:
- Average — mean execution time
- P90 — 90th percentile (90% of runs were faster than this)
- P95 — 95th percentile
- P99 — 99th percentile
Example: proving an index helped
You suspect a filter on organizations.plan needs an index. Benchmark the query at 100 iterations and note the numbers (say avg 42 ms, P99 110 ms). Add the index in the Table Designer, benchmark again, and compare — if the average drops to 3 ms and P99 to 6 ms, the win is real and consistent, not a fluke of one lucky run. Watch the P99 especially: an index that fixes the average but leaves a fat tail is often a caching artifact, not a genuine improvement.
Percentiles describe worst-case behavior, not just the average — a query with a great average but a bad P99 will still feel janky under load. Pair this with Query Plans to see why a query is slow before you benchmark the fix.
Related
- Query Plans —
EXPLAINthe query to find the bottleneck - Query Telemetry — timing breakdown of a single execution
- Performance Analysis — detect missing indexes and slow patterns