SQLXtraLite
written from scratch · zero dependencies
SQLXtraLite is an embedded, single-file SQL database — no server, no setup, no dependencies — with SQLite-compatible storage, a WAL, and a MySQL-friendly dialect.
Fast enough to go toe-to-toe with SQLite on real analytical queries. Compatible enough to run a full WordPress + WooCommerce store with no MySQL at all.
Tokenizer, parser, query planner, a register-based VDBE, B-tree storage, a pager with a page cache, write-ahead logging, and cross-process locking — all hand-rolled, all in one crate with no third-party code.
The whole database is one file. No server process, no configuration, no daemon. Open it and go.
Everything from the LEB128 varints to the B-tree splitter is written from scratch. Nothing in [dependencies].
Paged B-tree tables and indexes, serial-type record encoding, a trunk-page freelist, and overflow pages.
Write-ahead logging with checkpointing, plus a rollback-journal mode. Atomic commits, durable on fsync.
Cross-process file locking: concurrent readers with a single writer, safe across multiple worker processes.
Joins, aggregates, subqueries, CASE, UNION, REPLACE, and ON DUPLICATE KEY UPDATE — enough to run real apps.
Parse & compile once, bind ? params, re-execute — 3.2× faster for row-at-a-time inserts.
PRAGMA integrity_check detects index/table drift; PRAGMA reindex rebuilds indexes from table truth.
An interactive shell like sqlite3: dot-commands, table output, .dump backups, .read scripts.
Eight complex analytical queries (joins, group-by, subqueries, anti-joins) over a ~150k-row dataset, versus the sqlite3 CLI — identical results on every query.
| Query | vs SQLite |
|---|---|
| Revenue by category (join + group) | 0.95× |
| Active countries (group + having + distinct) | 0.61× |
| Products never ordered (anti-join) | 0.08× |
| LIKE + IN filter (join + distinct) | 0.97× |
| Top customers by spend (3-way join) | 1.25× |
| Avg line value by country (3-way join) | 1.37× |
| Overall (8 queries) | 1.11× |
Measured on the bundled examples/ harnesses (release build). “× vs SQLite” < 1 means SQLXtraLite is faster; SQLite times are user+sys CPU, SQLXtraLite is wall-clock, so the real gap is a little narrower. Run them yourself: cargo run --release --example bench_vs_sqlite.
A full WordPress + WooCommerce store runs on SQLXtraLite through a PHP-FFI drop-in — no MySQL process anywhere. Products, carts, orders, sessions, the admin: all served by the embedded engine.
A real WooCommerce shop, served entirely by the engine. Lighter and cheaper to host than the usual WP+MySQL stack — a single self-contained, low-footprint deployment, ideal for small/medium sites, edge, and appliances.
// WordPress talks to SQLXtraLite over FFI —
// no mysqld, no socket, no network.
$db = FFI::cdef("…", "libsqlxtralite.so");
// one file holds the whole store:
$ du -h wp-content/database/wpsxl.db
18M wpsxl.db
// MySQL processes running:
$ pgrep mysqld | wc -l
0
Built to be familiar from both worlds — SQLite semantics underneath, MySQL conveniences on top.
On the roadmap: window functions, CTEs (WITH), FULL JOIN, foreign-key enforcement.
import sqlxtralite
con = sqlxtralite.connect("shop.db")
cur = con.cursor()
cur.execute("CREATE TABLE items (id INTEGER PRIMARY KEY, name TEXT, price REAL)")
# bind ? params — insert many rows at once
cur.executemany("INSERT INTO items VALUES (?, ?, ?)",
[(1, "basil", 2.95), (2, "tomato", 3.50)])
cur.execute("SELECT name, price FROM items WHERE price > ?", (3,))
print(cur.fetchall()) # [('tomato', 3.5)]
$ sxl shop.db
SXLXtraLite shell — type .help, .quit to exit
sxl> SELECT name, price FROM items LIMIT 2;
+--------+-------+
| name | price |
+--------+-------+
| basil | 2.95 |
| tomato | 3.50 |
+--------+-------+
(2 rows)
sxl> .dump > backup.sql
sxl> PRAGMA integrity_check;
ok
SQLXtraLite is proprietary software — the source isn't public. Try the Python package from PyPI, then license it for production use, embedding, or redistribution.
Install sqlxtralite from PyPI and evaluate it on your own data — no account, no key. Prebuilt for Linux, macOS, and Windows.
For shipping it in a product, appliance, or hosted service, get a commercial license with support. Email barisakin@gmail.com.
SQLXtraLite is an independent, from-scratch engine. “SQLite”, “MySQL”, and “WordPress” are trademarks of their respective owners and are referenced only to describe compatibility.