hn.today

Show HN: Musql, JIT-compiled SQL, up to 300x faster than SQLite, 1000x vs. Turso

github.com11 points4 comments
Screenshot of Show HN: Musql, JIT-compiled SQL, up to 300x faster than SQLite, 1000x vs. Turso

musql is a SQLite-compatible database engine that pairs a columnar on-disk segment format with a JIT compiler to run supported query paths as native machine code. Columns are stored contiguously and writes go to an append-only delta, which lets vectorized filter and aggregate kernels operate directly on column values and avoid per-row decoding and interpreter overhead. The project is pure Go (no cgo), registers as a sqlite-compatible driver for database/sql, and can also run as a server (musqld) speaking the libSQL/Turso protocol. It implements a broad subset of SQLite features - joins, window functions, triggers, JSON, FTS, R-tree indexes - and offers CRDT or leader-mode replication.

Benchmarks on 100k-row read workloads show large speedups: a single-predicate filtered count took ~21 µs (about 300× faster than native C SQLite and nearly 1,000× faster than Turso), with other queries ranging from single-microsecond index lookups to multi-millisecond grouped aggregates; multithreaded and 1M-row behavior is documented. Data lives in .musq segments, so existing SQLite files must be converted with musql-convert for compatibility; a differential test harness ran 73,855 SQL statements from SQLite’s test corpus with zero wrong results and zero panics except a small number of declined storage-specific pragmas. The repo includes examples, a converter, docs, and instructions to embed or serve musql.

Read on github.com4 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Hardware

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.