Cost-based optimizer with selectivity estimation, adaptive re-optimisation mid-execution, parallel query planning, and EXPLAIN visualisation.
Every SQL query flows through four stages:
| Stage | Description |
|---|---|
| 1. Parser | SQL text → Abstract Syntax Tree (AST). 142+ keywords, SQL:2023 grammar. |
| 2. Planner | AST → logical plan. Resolves tables, columns, types. Applies RLS filters. |
| 3. Optimizer | Logical plan → physical plan. Cost-based index selection, join ordering, parallel decisions. |
| 4. Executor | Physical plan → results. Volcano iterator model with optional SIMD vectorisation and JIT. |
The optimizer estimates the cost of each plan candidate based on:
parallel_min_rows)If the optimizer's cardinality estimate diverges significantly from actual rows during execution, Absolute DB can switch plans mid-query:
SET adaptive_reoptimize = off for deterministic plan testing.
| Feature | Details |
|---|---|
| Thread pool | Up to 64 workers, auto-sized to CPU count |
| Work stealing | Idle workers steal from busy workers' deques |
| Parallel scan | B+Tree leaf pages split into N ranges |
| Parallel hash join | Hash-partition both inputs into N buckets |
| Parallel aggregation | Per-worker partial aggregates, coordinator merges |
| Gather node | N-way tournament tree merge for sorted output |
-- Text output
EXPLAIN SELECT * FROM orders WHERE status = 'pending';
-- Analyse (actually execute and show actual row counts)
EXPLAIN ANALYZE SELECT * FROM orders WHERE status = 'pending';
-- Visual SVG tree in the web console
-- Navigate to Console > EXPLAIN panel, paste query, click "Explain"
The optimizer can route qualifying expressions through two acceleration paths:
Both are transparent to the user and activated automatically by the optimizer when beneficial.
~154 KB binary · zero external dependencies · 2,737 tests passing