- Category
- Developer Tools
- Rank
- No. 1277Tools index
Previous survey · No. 1265 ·
- Type
- TOOL
- Use case
- Data Processing
- Interfaces
- API
- GitHub
- 130 stars
- Latest release
- v0.6.0
- Date
About
musql is an embedded SQL database for Go that uses a JIT compiler to generate native query kernels. The author reports a 100K-row filtered count in 21 µs, about 300x faster than C SQLite and nearly 1,000x faster than Turso, measured single-threaded with a warm cache. It works with Go's database/sql or through a server for libSQL clients, uses its own storage format, and supports SQLite import and export.
At a glance
musql offers SQLite-style SQL on a column-oriented format with compiled query paths. It is worth benchmarking if an embedded workload spends most of its time filtering and aggregating many rows.
Good fit
Developers who can compare a representative read workload and validate migration on a copy.
Consider something else when
Keep SQLite if exact file compatibility is required or your workload already performs well.
Start here
Import a copy of a small SQLite database into musql’s format. Compare query results and measure one representative read and write workload before changing your application.
Cost and requirements
Apache 2.0. The repository declares Go 1.27 and documents an embedded Go driver, conversion tools and a server mode.
Limits to know
The storage format differs from SQLite and supported query paths matter for acceleration. The project’s benchmark measures a specific filtered count. Check your own schema and SQL compatibility.
Sources checked 2026-11-05. Source-based assessment.
Read the source review
What it does
musql reimplements the SQLite dialect in pure Go, with its own parser, planner and bytecode interpreter, but stores each table column by column instead of row by row. At run time it translates hot loops into machine code that walks those column blocks directly, so filters and aggregates skip the per-row decoding that bounds classic SQLite. Writes land in an append-only log that is later folded into fresh column blocks. You reach it three ways: as a drop-in Go driver, through a shell, or as a small HTTP server that Turso's client libraries talk to without changes.
Why it's ranked here
The ambition is unusual and the proof is unusually checkable. The project replays the statements mined from SQLite's own test suite against real SQLite and reports zero wrong answers and zero crashes, and the benchmark harness fails if any timed query stops beating C SQLite or falls off the compiled path. It is Apache 2.0, has no C dependency, and its single external Go requirement is the standard system-call package. Those facts make it worth evaluating for read-heavy Go services today, though the speed figures are the author's own measurements on a few machines.
What's good
The compatibility work is measured rather than asserted: the swap-readiness notes tie each claim to a named test, including the SQL that golang-migrate, GORM, Ent and sqlc generate. Unsupported shapes either decline cleanly or fall back to the interpreter, never to a second executor with different semantics. The design notes are candid, recording reverted attempts and a wrong answer the differential test caught. The converter checks source integrity before importing and refuses a damaged file unless forced. The server supports read-only tokens mapped to a separate database and closes idle streams after ten seconds by default.
Tradeoffs
It does not open SQLite files. Every existing database must be converted first, and a file written by musql needs exporting before other SQLite tools can read it. The engine is reached only through Go's database interface, so loadable extensions, custom C functions, the backup API and incremental blob access are out of scope. Concurrent writing by a C SQLite process and a musql process on the same file is explicitly not claimed. Timestamp columns come back as stored text unless you set a flag, which differs from the popular cgo driver. The author notes that without the compiler, scans lose to C SQLite by a large multiple.
How to use it well
Pick it for a Go service that runs repeated analytical reads, such as counts, sums, grouped aggregates and top-N queries, over a local database it owns, where removing C from the build also matters. Convert a copy of your current file, point the driver at it, and run your own query mix before trusting the published multiples. Turn on the timestamp flag if your models scan dates into time values. Keep one statement per call, as the docs require. For a mixed-language team, the server lets TypeScript code use the standard libSQL client. It is not the tool for sharing one file with other SQLite processes.
Technical notes+
go.mod declares module github.com/samyfodil/musql on go 1.27.0 with golang.org/x/sys as its only requirement. docs/architecture.md traces a read: the driver binds arguments, the engine checks a plan cache keyed on statement text, parses, flattens views and CTEs, plans with a port of SQLite's WHERE-clause planner, compiles to a Program of SQLite opcodes plus musql's own, then runs peephole recognisers that prepend guard opcodes which answer from a columnar kernel or decline back to the compiled loop. A whole-program JIT caches native code on the Program and exits to the interpreter at any unsupported instruction; backends exist for amd64, arm64 and wasm. docs/format-design.md specifies fixed-width little-endian column blocks per 64k-row segment, out-of-line TEXT/BLOB heaps, NULL bitmaps and a per-row exception list for mixed types. hrana/server.go serves Hrana v2/v3 over JSON and Protobuf, caps request bodies at 64 MB, rotates a random baton per response and refuses to hand a read-write stream to a read-only client. cmd/musql-convert/main.go exposes import with a -force flag for sources failing integrity_check, and export with an optional page size.
Observed
- License
- Apache License 2.0 (LICENSE)
- Language
- Go, pure Go with no cgo, per README
- Dependencies
- golang.org/x/sys is the only requirement in go.mod
- Interfaces
- Go database/sql driver registered as sqlite and musql, CLI shell, Hrana HTTP server for libSQL clients
- Install surface
- go get for the driver, release archive binaries, Docker image built from a scratch base
- File format
- Own segment format; SQLite files need import or export through the converter
- JIT targets
- amd64, arm64 and wasm backends (docs/architecture.md)
- Server protocol
- Hrana v2 and v3 over JSON and Protobuf, bearer-token auth with optional read-only mode (hrana/server.go)
Read from README.md, go.mod, LICENSE, docs/architecture.md, docs/benchmarks.md, docs/swap-readiness.md, docs/format-design.md, hrana/server.go, cmd/musql-convert/main.go.
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.