Home Expressions
Docs
Drivers Gateway SDKs Benchmarks
Changelog
GitHub
Blog Status Roadmap
← Back to benchmark index
Current PostgreSQL native report March 31, 2026

PostgreSQL Native DSL Matrix: April 2026

Current local benchmark for qail-rs executing native QAIL ASTs against pgx executing SQL strings across five workloads and four execution modes, refreshed on April 22, 2026 with two-round medians.

This is the canonical public Rust PostgreSQL benchmark for native QAIL DSL versus pgx SQL. It replaces the earlier raw-SQL qail-rs page, which measured protocol/runtime overhead rather than the DSL surface. The latest April 22 median refresh is the live data on this page; the previous March 31 median snapshot is retained below as historical context. The Zig driver benchmark stays separate on /zig/benchmarks, and the ORM/SQLx baseline stays on its own benchmark page.
14 / 15

throughput slices won by qail-rs in the latest median refresh

555,995 q/s
Peak throughput
point lookup in pipeline mode on qail-rs
1.58x
Strongest throughput gain
point pool10: 169,501 q/s on qail-rs vs 107,278 q/s on pgx
5 / 5
p50 slices won
latest April 22 latency refresh; p99 stays positive in 4 of 5 slices

Benchmark Surface

Canonical local snapshot refreshed on April 22, 2026. This page keeps one stable PostgreSQL native-DSL report URL: tables and charts show the latest median refresh, while earlier snapshots are preserved in the narrative so history is not lost.

AxisValue
Driversqail-rs native Qail ASTs versus pgx SQL strings
Workloadspoint, wide_rows, large_rows, many_params, aggregate
Modessingle, pipeline, pool10, latency
DB targetLocal defaults on this page; both runners also accept DATABASE_URL or QAIL_BENCH_DATABASE_URL
RoundsROUNDS=2 on this page, ROUNDS=6 still recommended for publication-quality reruns
Harnesspg/examples/abba_qail_native_pgx.sh in the qail.rs workspace
qail-rs runnerpg/examples/qail_native_pgx_once.rs
pgx runnerpg/examples/pgx_native_benchmark.go
Sibling benchmark pagesThis page stays the canonical qail-rs native-vs-pgx report; qail-zig vs pg.zig and ORM/SQLx comparisons remain on their own stable pages

Native Throughput

Cells show pgx, qail-rs, then the qail-rs/pgx ratio. Higher is better.

WorkloadSinglePipelinePool10
Point lookuppgx 35,028
qail-rs 41,820
1.19x
pgx 410,121
qail-rs 555,995
1.36x
pgx 107,278
qail-rs 169,501
1.58x
Wide rowspgx 4,196
qail-rs 4,587
1.09x
pgx 3,903
qail-rs 5,388
1.38x
pgx 7,358
qail-rs 10,731
1.46x
Large rowspgx 134
qail-rs 158
1.18x
pgx 142
qail-rs 175
1.23x
pgx 390
qail-rs 443
1.14x
Many paramspgx 23,066
qail-rs 26,434
1.15x
pgx 78,156
qail-rs 99,737
1.28x
pgx 89,286
qail-rs 128,905
1.44x
Aggregatepgx 607
qail-rs 657
1.08x
pgx 719
qail-rs 851
1.18x
pgx 3,549
qail-rs 3,503
0.99x

Latest April 22 median refresh: qail-rs wins 14 of 15 throughput cells. The exception is aggregate/pool10, where pgx is slightly ahead. Earlier March snapshots remain in this report as historical context.

Throughput — Pipeline Mode

Pipeline-mode queries per second. Higher is better.

pgx qail-rs ↑ q/s
Point lookup Wide rows Large rows Many params Aggregate pgx: 410,121 q/s pgx: 3,903 q/s pgx: 142 q/s pgx: 78,156 q/s pgx: 719 q/s qail-rs: 555,995 q/s (1.36×) qail-rs: 5,388 q/s (1.38×) qail-rs: 175 q/s (1.23×) qail-rs: 99,737 q/s (1.28×) qail-rs: 851 q/s (1.18×)
Workload pgxqail-rs Ratio
Point lookup 410K 556K 1.36×
Wide rows 3.9K 5.4K 1.38×
Large rows 142 175 1.23×
Many params 78K 100K 1.28×
Aggregate 719 851 1.18×

Throughput — Pool10

Pool10-mode queries per second. Higher is better.

pgx qail-rs ↑ q/s
Point lookup Wide rows Large rows Many params Aggregate pgx: 107,278 q/s pgx: 7,358 q/s pgx: 390 q/s pgx: 89,286 q/s pgx: 3,549 q/s qail-rs: 169,501 q/s (1.58×) qail-rs: 10,731 q/s (1.46×) qail-rs: 443 q/s (1.14×) qail-rs: 128,905 q/s (1.44×) qail-rs: 3,503 q/s (0.99×)
Workload pgxqail-rs Ratio
Point lookup 107K 170K 1.58×
Wide rows 7.4K 11K 1.46×
Large rows 390 443 1.14×
Many params 89K 129K 1.44×
Aggregate 3.5K 3.5K 0.99×

Latency Snapshot

Lower is better. The table shows p50 and p99 in milliseconds for the single-query latency mode.

Workloadp50p99
Point lookuppgx 0.026 ms
qail-rs 0.024 ms
-10.03%
pgx 0.078 ms
qail-rs 0.043 ms
-45.24%
Wide rowspgx 0.285 ms
qail-rs 0.217 ms
-23.71%
pgx 0.757 ms
qail-rs 0.547 ms
-27.76%
Large rowspgx 7.791 ms
qail-rs 6.530 ms
-16.18%
pgx 9.324 ms
qail-rs 8.060 ms
-13.55%
Many paramspgx 0.040 ms
qail-rs 0.035 ms
-11.68%
pgx 0.107 ms
qail-rs 0.118 ms
+10.64%
Aggregatepgx 1.826 ms
qail-rs 1.771 ms
-3.01%
pgx 3.048 ms
qail-rs 2.869 ms
-5.88%

Latest April 22 latency refresh: qail-rs is lower on all five p50 slices and four of five p99 slices. The only negative tail case in this run is many_params, where pgx keeps a tighter p99.

Latency — p99

p99 latency in milliseconds. Lower is better.

pgx qail-rs ↓ ms
Point lookup
0.078 ms
0.043 ms
−45%
Wide rows
0.757 ms
0.547 ms
−28%
Large rows
9.3 ms
8.1 ms
−14%
Many params
0.107 ms
0.118 ms
+11%
Aggregate
3.0 ms
2.9 ms
−6%

Interpretation

This native matrix is the benchmark that matters for the public qail-rs story. qail-rs starts from native Qail ASTs here, while pgx continues to execute SQL strings. In the latest April 22 median refresh, qail-rs wins 14 of 15 throughput cells, all five p50 latency cells, and four of five p99 latency cells.

The strongest latest wins are where dispatch and execution-path overhead is exposed most clearly: 1.58x on point lookup pool10, 1.46x on wide_rows pool10, and 1.44x on many_params pool10. The main softness in this refresh is narrow: aggregate/pool10 is slightly negative on throughput, and many_params is the only p99 tail-latency loss.

Historical context still matters: prior March snapshots are retained in this report, but April 22 is now the live canonical read. The page keeps one stable URL and refreshes the tables/charts with new medians instead of creating a new benchmark page every run.

The earlier public Rust-vs-pgx page used the wrong surface for qail-rs by starting from raw SQL. That page measured protocol/runtime behavior only. This report supersedes it and should be treated as the canonical PostgreSQL benchmark page for qail-rs.

Revision Notes

  • This report supersedes the earlier public Rust-vs-pgx page that measured qail-rs from raw SQL instead of native Qail ASTs.
  • The qail-rs side now runs through pg/examples/qail_native_pgx_once.rs, while pgx stays on SQL strings through pg/examples/pgx_native_benchmark.go.
  • The aggregate workload now uses the dedicated four-column zero-copy receive path on qail-rs, and the hot query/pipeline paths reuse presized buffers more aggressively.
  • April 22, 2026 is now the live canonical refresh on this page: latest tables and charts use the new two-round medians while prior March snapshots remain as context.
  • The benchmark family stays split by surface for clarity and SEO: native qail-rs vs pgx here, qail-zig vs pg.zig on the Zig page, and ORM/SQLx comparisons on their own report.
  • DB target selection remains env-driven via DATABASE_URL or QAIL_BENCH_DATABASE_URL, so the same harness can be rerun against local or remote PostgreSQL.

Reproduce

Use local defaults, or set <code>DATABASE_URL</code> to point at a remote PostgreSQL instance.

git clone https://github.com/qail-io/qail.git
cd qail

DATABASE_URL='postgresql://user:pass@host:5432/db?sslmode=disable' \
RUNNERS='pgx qail_rs' \
ROUNDS=6 \
bash pg/examples/abba_qail_native_pgx.sh