388us
qail-pg latency
baseline
1.35x
SQLx latency ratio
vs qail-pg
1.09x
SeaORM latency ratio
vs qail-pg
Test Parameters
| Parameter | Value |
|---|---|
| Iterations | 10,000 sequential queries |
| Warmup | 100 queries |
| Connection | Single persistent connection |
| Database | PostgreSQL 16 on localhost |
| Data | 4 departments, 1,000 employees |
Query Shape
WITH high_earners AS (
SELECT * FROM employees WHERE salary > 80000
)
SELECT e.*, d.name AS dept_name
FROM high_earners e
JOIN departments d ON e.department_id = d.id
WHERE e.status = 'active'
ORDER BY e.salary DESC
LIMIT 100 Measured Results
| Driver | Total time | Per query | Relative latency vs qail-pg |
|---|---|---|---|
| qail-pg | 3,881ms | 388.09us | 1.00x |
| SeaORM | 4,216ms | 421.62us | 1.09x |
| SQLx | 5,245ms | 524.52us | 1.35x |
Observed sources of difference
- The AST path serializes directly to bytes on the wire protocol path.
- The query builder stays allocation-light under the workload used here.
- Application-side mapping and abstraction work are lower than the ORM baselines in this harness.
Comparison notes
- All drivers used a single persistent connection.
- The result set and query complexity were matched across the run.
- Queries were sequential, so no driver received a concurrency advantage.
- SeaORM was tested with raw SQL rather than full entity abstraction.
Reproduce
git clone https://github.com/qail-io/qail.git
cd qail
cargo run --example orm_benchmark --release