Skip to main content
v1.15.0 - Multi-Dialect SQL Parser

Parse SQL at the speed of Go

Production-ready SQL parsing with zero-copy tokenization, object pooling, and multi-dialect support

query.sql
Precomputed sample
GenericSELECT
SELECT u.name, u.email, COUNT(o.id) AS order_count, SUM(o.total) AS lifetime_value
FROM users u
LEFT JOIN orders o ON o.user_id = u.id
WHERE u.created_at > '2024-01-01'
GROUP BY u.name, u.email
HAVING COUNT(o.id) > 5
ORDER BY lifetime_value DESC
LIMIT 20;

Built for production

  • 120GitHub stars
  • 3,100+Go test functions, race-detector clean in CI
  • ~0.32 µsto parse a simple SELECT (parse stage, Apple M4, Go 1.27)
  • 8SQL dialects, one parser

Performance That Speaks for Itself

~3.14M

parses/sec, simple SELECT (parse stage)

318ns

latency, simple SELECT (parse stage)

~858K

parses/sec, complex query (parse stage)

1,165ns

latency, complex query (parse stage)

Parse stage only (not tokenize or end-to-end), Apple M4, Go 1.27. Source: BenchmarkPerformanceBaseline, median of 10 runs, re-measured 2026-10-13.

Reproduce

go test -run='^$' -bench=BenchmarkPerformanceBaseline -benchmem -count=10 ./pkg/sql/parser/

Everything you need to work with SQL in Go

Multi-Dialect

PostgreSQL, MySQL, MariaDB, SQLite, SQL Server, Oracle, Snowflake, ClickHouse.

Thread-Safe

Race-detector clean in CI.

Zero-Copy

Direct byte slice operations. No unnecessary allocations.

Object Pooling

sync.Pool recycling for ASTs, tokenizers, expressions.

Security Scanner

SQL injection detection with severity classification.

MCP Server

7 SQL tools for Claude, Cursor, and any MCP client.

Simple, Powerful API

main.go
1package main
2 
3import "github.com/ajitpratap0/GoSQLX/pkg/gosqlx"
4 
5func main() {
6 // Parse SQL into an AST
7 ast, err := gosqlx.Parse("SELECT * FROM users WHERE active = true")
8 if err != nil {
9 log.Fatal(err)
10 }
11 fmt.Println(ast.Statements)
12}

Use it everywhere

The same parser powers your Go code, your AI assistant and your editor.

AI assistants

Connect 7 SQL tools to Claude, Cursor or any MCP client. No installation, no API key.

Terminal
$ claude mcp add --transport http gosqlx https://mcp.gosqlx.dev/mcp
Added gosqlx (7 tools available)
  • parse_sql
  • format_sql
  • validate_sql
  • lint_sql
  • analyze_sql
  • detect_injection
  • list_dialects
MCP guide

Editors

Real-time validation, formatting and linting as you type, across all 8 dialects, through the built-in language server (gosqlx lsp).

Ready to parse SQL at the speed of Go?