Skip to content

Replace node-sql-parser with sqlparser-ts#874

Open
guan404ming wants to merge 2 commits intodrawdb-io:mainfrom
guan404ming:replace-node-sql-parser-with-sqlparser-ts
Open

Replace node-sql-parser with sqlparser-ts#874
guan404ming wants to merge 2 commits intodrawdb-io:mainfrom
guan404ming:replace-node-sql-parser-with-sqlparser-ts

Conversation

@guan404ming
Copy link

@guan404ming guan404ming commented Feb 18, 2026

Replaced node-sql-parser + oracle-sql-parser with sqlparser-ts, a WASM-powered SQL parser wrapping Rust's sqlparser from Apache DataFusion. It offers superior performance with zero JS/TS dependencies.

The pkg was developed by me and officially adopted by Apache Airflow, this package has proven its stability in production environments.

More detailed bench -> https://github.com/guan404ming/sqlparser-ts/tree/main/benchmark

@vercel
Copy link

vercel bot commented Feb 18, 2026

@guan404ming is attempting to deploy a commit to the dottle's projects Team on Vercel.

A member of the Team first needs to authorize it.

@guan404ming
Copy link
Author

guan404ming commented Feb 18, 2026

Benchmark: node-sql-parser vs sqlparser-ts

Summary

This optimization slashed the package size by 96% and boosted parse speed by up to 2.7x, while delivering broader SQL dialect coverage and smaller bundle size.

Metric Before After Change
Package size 88 MB 3.5 MB -96%
Total node_modules 547 MB 465 MB -15%
JS bundle (main chunk) 17,220 KB 14,290 KB -17%
JS bundle (gzip) 3,197 KB 2,634 KB -18%
WASM asset 0 KB 3,516 KB (985 KB gzip) new
Build time (avg of 3) ~26.3s ~17.3s -34%
Supported dialects 4 + Oracle (separate pkg) 14 (unified) +10 dialects
Oracle support Separate oracle-sql-parser Built-in unified
Test coverage 0 tests 75 tests new

Parse Speed by Dialect

1,000 iterations per dialect. Simple SQL uses a single CREATE TABLE with constraints. SQLite (complex) uses an 8-table e-commerce schema with 9 indices, foreign keys, CHECK constraints, and DEFAULT values (17 statements).

Dialect node-sql-parser sqlparser-ts Change
MySQL 63.5 us 72.8 us +15%
PostgreSQL 103.8 us 38.5 us 2.7x faster
SQLite 1,117 us 603 us 1.9x faster
MSSQL 69.3 us 25.6 us 2.7x faster
Oracle N/A (separate parser) 24.2 us new

MySQL is slightly slower due to WASM overhead on simple queries, but PostgreSQL and MSSQL see significant speedups. The advantage grows with SQL complexity, as shown by the SQLite complex benchmark. Oracle support is now built-in instead of requiring a separate package.

@guan404ming guan404ming marked this pull request as draft February 18, 2026 03:45
@guan404ming guan404ming marked this pull request as ready for review February 18, 2026 04:24
@guan404ming
Copy link
Author

Hi @1ilit, could you help take a look at this, thanks!

Signed-off-by: Guan-Ming (Wesley) Chiu <105915352+guan404ming@users.noreply.github.com>
Signed-off-by: Guan-Ming (Wesley) Chiu <105915352+guan404ming@users.noreply.github.com>
@guan404ming guan404ming force-pushed the replace-node-sql-parser-with-sqlparser-ts branch from a7dd05a to 8f6cf81 Compare February 27, 2026 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant