Compare / xwb1989/sqlparser
xwb1989/sqlparser alternative: GoSQLX compared
xwb1989/sqlparser is a standalone MySQL parser extracted from Vitess. It is widely imported, but its last commit was 2018-06-06.
- Approach
- Fork of the Vitess MySQL parser, extracted as a standalone package
- Dialect
- MySQL
- CGo required
- No
- Maintenance
- Latest commit on the default branch: 2018-06-06 (120387863bf2). This is the version pinned in the benchmark harness.
Pick xwb1989/sqlparser when
- You have an existing integration that only uses simple MySQL statements and it works for you.
- You need the exact AST shape of this package for code you cannot change yet.
Pick GoSQLX when
- You need syntax this parser rejects in the benchmark run below, such as CTEs and window functions.
- You want a dependency that still receives releases.
- You need other dialects, or formatting, linting and security scanning.
Parse speed, measured
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 · xwb1989/sqlparser v0.0.0-20180606152119-120387863bf2. Lower is faster.
| Query | GoSQLX | xwb1989/sqlparser |
|---|---|---|
| Simple SELECT | 2,160 ns | 10,583 ns |
| SELECT with WHERE, ORDER BY, LIMIT | 5,119 ns | 15,836 ns |
| Two-table JOIN | 7,892 ns | 35,789 ns |
| GROUP BY with HAVING | 5,614 ns | 16,219 ns |
| IN subquery | 4,833 ns | 29,743 ns |
| Common table expression | 6,738 ns | not supported |
| Window function | 4,457 ns | not supported |
| Multi-JOIN analytical query | 21,006 ns | 57,680 ns |
| INSERT VALUES | 3,549 ns | 12,479 ns |
| UPDATE with WHERE | 3,190 ns | 12,334 ns |
| DELETE with WHERE | 2,045 ns | 9,347 ns |
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. Results vary by query, so check the rows that resemble your workload.
Full table, methodology and reproduce steps: competitor benchmarks. Source: benchmarks/compare/results/latest.json, commit 3655a37.
What GoSQLX offers
Pure Go with no CGo, 8 dialects, 30 built-in lint rules, a formatter, a SQL injection scanner, an LSP server and an MCP server. Requires Go 1.26+.