Performance Benchmarks
Parse-stage performance of the GoSQLX parser, re-measured with the in-repo benchmarks.
Measured 2026-11-02 · Apple M4 · Go 1.27 · parse stage only
Parse Benchmarks
Parse-stage throughput (Apple M4, Go 1.27)
Measured on Apple M4 · Go 1.27 · parse stage · median of 10 runs · 2026-11-02 · source BenchmarkPerformanceBaseline. Reproduce
Competitor Comparison
End-to-end stage (SQL text to AST) · AMD EPYC 7763 64-Core Processor (linux/amd64) · go1.26.9 · median of 10 runs · measured 2026-11-02 · commit 3655a37
| Query | GoSQLX | pg_query_go | Vitess sqlparser | TiDB parser | xwb1989/sqlparser |
|---|---|---|---|---|---|
| Simple SELECT | 2,160 ns | 14,024 ns | 2,193 ns | 3,782 ns | 10,583 ns |
| SELECT with WHERE, ORDER BY, LIMIT | 5,119 ns | 42,716 ns | 4,941 ns | 9,702 ns | 15,836 ns |
| Two-table JOIN | 7,892 ns | 56,958 ns | 6,427 ns | 11,719 ns | 35,789 ns |
| GROUP BY with HAVING | 5,614 ns | 33,957 ns | 4,230 ns | 8,876 ns | 16,219 ns |
| IN subquery | 4,833 ns | 30,556 ns | 5,585 ns | 8,525 ns | 29,743 ns |
| Common table expression | 6,738 ns | 43,665 ns | 6,074 ns | 12,576 ns | not supported |
| Window function | 4,457 ns | 27,460 ns | 5,348 ns | 8,322 ns | not supported |
| Multi-JOIN analytical query | 21,006 ns | 152,898 ns | 16,634 ns | 30,113 ns | 57,680 ns |
| INSERT VALUES | 3,549 ns | 17,491 ns | 2,876 ns | 5,350 ns | 12,479 ns |
| UPDATE with WHERE | 3,190 ns | 18,254 ns | 2,739 ns | 5,381 ns | 12,334 ns |
| DELETE with WHERE | 2,045 ns | 11,437 ns | 1,764 ns | 3,147 ns | 9,347 ns |
Median ns per statement; lower is faster and the fastest library per query is in bold. Hover a query name to see its SQL.
← Swipe to see all columns →
Read with care. The libraries implement different SQL dialects and build different ASTs (pg_query_go wraps the real PostgreSQL parser through CGo and converts its tree to Go structs; Vitess, TiDB and xwb1989 implement MySQL grammars). Each figure is the end-to-end cost of turning the same SQL text into that library's AST on the stated hardware, not identical work.
- GoSQLX:
github.com/ajitpratap0/GoSQLXcommit 3655a37900cd · multi-dialect (default settings) - pg_query_go:
github.com/pganalyze/pg_query_go/v6v6.2.5 · PostgreSQL (the real PostgreSQL grammar via CGo) - Vitess sqlparser:
vitess.io/vitessv0.24.5 · MySQL - TiDB parser:
github.com/pingcap/tidb/pkg/parserv0.0.0-20261015143638-7193401b6746 · MySQL (TiDB) - xwb1989/sqlparser:
github.com/xwb1989/sqlparserv0.0.0-20180606152119-120387863bf2 · MySQL (2018 Vitess fork, unmaintained)
Reproduce with task bench:publish using the benchmark harness, which pins every library version and keeps the raw output for benchstat. See also the feature comparison.
Reproduce these numbers
Clone the repository, then run the commands below. Absolute numbers depend on your hardware; compare ratios, not raw ns/op.
Parse stage (the charts above)
go test -run='^$' -bench=BenchmarkPerformanceBaseline -benchmem -count=20 ./pkg/sql/parser/Summarise the 10 runs with benchstat to get the median.
Competitor comparison (end-to-end)
cd benchmarks/compare && go test -run=^$ -bench=^BenchmarkParse$ -benchmem -count=10 .Needs CGO for pg_query_go. Summarise with benchstat; `task bench:publish` runs this and writes results/latest.json and latest.txt.
CI regression check (not a measurement)
go test -run TestPerformanceRegression ./pkg/sql/parser/Compares against the loose ceilings in the baselines file; skipped under the race detector.
- Parse benchmark source:
pkg/sql/parser/performance_regression_test.go - CI baselines:
performance_baselines.json - Competitor harness:
benchmarks/compare - CI runs: Competitor Benchmarks workflow
Methodology
- Go 1.27 on Apple M4 (arm64); every figure is for the parse stage only (pre-tokenized input to AST), not tokenize or end-to-end
- Source: BenchmarkPerformanceBaseline, median of 20 runs, re-measured 2026-11-02, run with
-benchmem - Reproduce:
go test -run='^$' -bench=BenchmarkPerformanceBaseline -benchmem -count=20 ./pkg/sql/parser/ - Race detector disabled during benchmarks (adds 3–5x overhead)
- Object pooling enabled for all runs (production configuration)
- The CI regression baseline is a deliberately loose ceiling used with a tolerance on slower shared runners; it is not a measurement
Ready to use GoSQLX in your project?