Distributed, MVCC SQLite that runs on FoundationDB.
See the codeDistributed, MVCC SQLite that runs on top of FoundationDB.
LD_PRELOAD or a patched libsqlite3.so to plug mvSQLite into your existing apps. Read the docsThese features are not considered stable yet and should not be used in production without validation.
Commit groups let you batch writes from multiple mvSQLite databases into a single FoundationDB commit.
Enable the SQL functions with:
export MVSQLITE_EXPERIMENTAL_COMMIT_GROUP=1
Available SQL functions:
mv_commit_group_begin()mv_commit_group_commit(db_name)mv_commit_group_rollback(db_name)Example:
ATTACH 'orders' AS orders;
SELECT mv_commit_group_begin();
BEGIN;
INSERT INTO main.accounts(id, balance) VALUES (1, 100);
COMMIT;
BEGIN;
INSERT INTO orders.invoices(id, account_id) VALUES (1, 1);
COMMIT;
SELECT mv_commit_group_commit('main');
Notes:
mv_commit_group_commit(db_name) and mv_commit_group_rollback(db_name) require an explicit SQLite database name such as 'main' or an attached database name.mv_commit_group_commit(...) succeeds.SQLITE_PERM error.Grab the latest binaries from the Releases page. You can also build your own binaries to run on a platform other than x86-64.
Check the single-page mvSQLite Quick Reference for common operations with mvSQLite.
Install FoundationDB:
wget https://github.com/apple/foundationdb/releases/download/7.3.69/foundationdb-clients_7.3.69-1_amd64.deb
sudo dpkg -i foundationdb-clients_7.3.69-1_amd64.deb
wget https://github.com/apple/foundationdb/releases/download/7.3.69/foundationdb-server_7.3.69-1_amd64.deb
sudo dpkg -i foundationdb-server_7.3.69-1_amd64.deb
Download the binaries:
curl -L -o ./libmvsqlite_preload.so https://github.com/losfair/mvsqlite/releases/download/v0.2.1/libmvsqlite_preload.so
curl -L -o ./mvstore https://github.com/losfair/mvsqlite/releases/download/v0.2.1/mvstore
chmod +x ./mvstore
Run mvstore, the server-side half that should be colocated with the FoundationDB cluster in production:
RUST_LOG=info ./mvstore \
--data-plane 127.0.0.1:7000 \
--admin-api 127.0.0.1:7001 \
--metadata-prefix mvstore \
--raw-data-prefix m
Create a namespace with the admin API:
curl http://localhost:7001/api/create_namespace -i -d '{"key":"test"}'
Build libsqlite3 and the sqlite3 CLI: (note that a custom build is only needed here because the sqlite3 binary shipped on most systems are statically linked to libsqlite3 and LD_PRELOAD don't work)
wget https://sqlite.org/2026/sqlite-amalgamation-3510300.zip
unzip sqlite-amalgamation-3510300.zip
cd sqlite-amalgamation-3510300
gcc -O2 -fPIC --shared -o libsqlite3.so ./sqlite3.c -lpthread -ldl -lm
gcc -O2 -o sqlite3 ./shell.c -L. -lsqlite3
Set environment variables, and run the shell:
export RUST_LOG=info MVSQLITE_DATA_PLANE="http://localhost:7000"
# "test" is the key of the namespace we created earlier
LD_PRELOAD=../libmvsqlite_preload.so LD_LIBRARY_PATH=. ./sqlite3 test
You should see the sqlite shell now :) Try creating a table and play with it.
mvsqlite can be built with the standard Rust toolchain:
cargo build --release -p mvstore
cargo build --release -p mvsqlite
make -C mvsqlite-preload
Internals are documented in the wiki.
(top 24 of 57)
13,582 followers · starred Aug 2022
499 followers · starred Jul 2025
174 followers · starred Jan 2023
1,120 followers · starred Dec 2023
Distributed, MVCC SQLite that runs on FoundationDB.
See the codeDistributed, MVCC SQLite that runs on top of FoundationDB.
LD_PRELOAD or a patched libsqlite3.so to plug mvSQLite into your existing apps. Read the docsThese features are not considered stable yet and should not be used in production without validation.
Commit groups let you batch writes from multiple mvSQLite databases into a single FoundationDB commit.
Enable the SQL functions with:
export MVSQLITE_EXPERIMENTAL_COMMIT_GROUP=1
Available SQL functions:
mv_commit_group_begin()mv_commit_group_commit(db_name)mv_commit_group_rollback(db_name)Example:
ATTACH 'orders' AS orders;
SELECT mv_commit_group_begin();
BEGIN;
INSERT INTO main.accounts(id, balance) VALUES (1, 100);
COMMIT;
BEGIN;
INSERT INTO orders.invoices(id, account_id) VALUES (1, 1);
COMMIT;
SELECT mv_commit_group_commit('main');
Notes:
mv_commit_group_commit(db_name) and mv_commit_group_rollback(db_name) require an explicit SQLite database name such as 'main' or an attached database name.mv_commit_group_commit(...) succeeds.SQLITE_PERM error.Grab the latest binaries from the Releases page. You can also build your own binaries to run on a platform other than x86-64.
Check the single-page mvSQLite Quick Reference for common operations with mvSQLite.
Install FoundationDB:
wget https://github.com/apple/foundationdb/releases/download/7.3.69/foundationdb-clients_7.3.69-1_amd64.deb
sudo dpkg -i foundationdb-clients_7.3.69-1_amd64.deb
wget https://github.com/apple/foundationdb/releases/download/7.3.69/foundationdb-server_7.3.69-1_amd64.deb
sudo dpkg -i foundationdb-server_7.3.69-1_amd64.deb
Download the binaries:
curl -L -o ./libmvsqlite_preload.so https://github.com/losfair/mvsqlite/releases/download/v0.2.1/libmvsqlite_preload.so
curl -L -o ./mvstore https://github.com/losfair/mvsqlite/releases/download/v0.2.1/mvstore
chmod +x ./mvstore
Run mvstore, the server-side half that should be colocated with the FoundationDB cluster in production:
RUST_LOG=info ./mvstore \
--data-plane 127.0.0.1:7000 \
--admin-api 127.0.0.1:7001 \
--metadata-prefix mvstore \
--raw-data-prefix m
Create a namespace with the admin API:
curl http://localhost:7001/api/create_namespace -i -d '{"key":"test"}'
Build libsqlite3 and the sqlite3 CLI: (note that a custom build is only needed here because the sqlite3 binary shipped on most systems are statically linked to libsqlite3 and LD_PRELOAD don't work)
wget https://sqlite.org/2026/sqlite-amalgamation-3510300.zip
unzip sqlite-amalgamation-3510300.zip
cd sqlite-amalgamation-3510300
gcc -O2 -fPIC --shared -o libsqlite3.so ./sqlite3.c -lpthread -ldl -lm
gcc -O2 -o sqlite3 ./shell.c -L. -lsqlite3
Set environment variables, and run the shell:
export RUST_LOG=info MVSQLITE_DATA_PLANE="http://localhost:7000"
# "test" is the key of the namespace we created earlier
LD_PRELOAD=../libmvsqlite_preload.so LD_LIBRARY_PATH=. ./sqlite3 test
You should see the sqlite shell now :) Try creating a table and play with it.
mvsqlite can be built with the standard Rust toolchain:
cargo build --release -p mvstore
cargo build --release -p mvsqlite
make -C mvsqlite-preload
Internals are documented in the wiki.
(top 24 of 57)
13,582 followers · starred Aug 2022
499 followers · starred Jul 2025
174 followers · starred Jan 2023
1,120 followers · starred Dec 2023