written from scratch · zero dependencies

The SQLite-class SQL engine,
built from scratch in Rust.

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.

~1.1×
of SQLite on complex queries
0
external dependencies
14.6k
lines of Rust
147
passing tests
What it is

A complete database engine, top to bottom

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.

📦

Embedded & single-file

The whole database is one file. No server process, no configuration, no daemon. Open it and go.

🦀

Pure Rust, zero deps

Everything from the LEB128 varints to the B-tree splitter is written from scratch. Nothing in [dependencies].

🗄️

SQLite-style storage

Paged B-tree tables and indexes, serial-type record encoding, a trunk-page freelist, and overflow pages.

WAL & crash-safe

Write-ahead logging with checkpointing, plus a rollback-journal mode. Atomic commits, durable on fsync.

🔀

Concurrent readers

Cross-process file locking: concurrent readers with a single writer, safe across multiple worker processes.

🧩

MySQL-friendly dialect

Joins, aggregates, subqueries, CASE, UNION, REPLACE, and ON DUPLICATE KEY UPDATE — enough to run real apps.

🎯

Prepared statements

Parse & compile once, bind ? params, re-execute — 3.2× faster for row-at-a-time inserts.

🛟

Self-repair tooling

PRAGMA integrity_check detects index/table drift; PRAGMA reindex rebuilds indexes from table truth.

💻

sxl CLI shell

An interactive shell like sqlite3: dot-commands, table output, .dump backups, .read scripts.

Benchmarks

Neck-and-neck with SQLite

Eight complex analytical queries (joins, group-by, subqueries, anti-joins) over a ~150k-row dataset, versus the sqlite3 CLI — identical results on every query.

Queryvs 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×
INSERT throughput2.1M rows/s
Point lookups3.9M /s
Full table scan32M rows/s
Prepared vs re-parse3.2×
WAL vs rollback journal1.6–3×

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.

Proof of compatibility

It runs WordPress. Without MySQL.

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.

WooCommerce storefront Cart & sessions ~4,100 queries/sec under load Lower RAM — no DB daemon

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.

wp-content/db.php — drop-in
// 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
The dialect

A SQLite / MySQL hybrid

Built to be familiar from both worlds — SQLite semantics underneath, MySQL conveniences on top.

SELECT · JOIN · LEFT/RIGHT JOIN GROUP BY · HAVING · DISTINCT subqueries · IN (SELECT) aggregates (COUNT/SUM/AVG/MIN/MAX) CASE WHEN UNION / UNION ALL INSERT / UPDATE / DELETE REPLACE INTO ON DUPLICATE KEY UPDATE INSERT … SELECT ALTER TABLE ADD COLUMN transactions · WAL indexes · UNIQUE · prepared ? X'..' blob literals

On the roadmap: window functions, CTEs (WITH), FULL JOIN, foreign-key enforcement.

Get started

Open a database in three lines

app.py — Python
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 — interactive shell
$ 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
Licensing

Commercial & proprietary

SQLXtraLite is proprietary software — the source isn't public. Try the Python package from PyPI, then license it for production use, embedding, or redistribution.

Try it pip install

Install sqlxtralite from PyPI and evaluate it on your own data — no account, no key. Prebuilt for Linux, macOS, and Windows.

Commercial license contact

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.