rqlite is a lightweight, open-source, distributed relational database written in Go. It is built on the Raft consensus protocol and uses SQLite as its storage engine.
Release v8.27.0 introduces the capability to load SQLite extensions at startup, significantly expanding the functionality available within rqlite.
What are SQLite extensions?
SQLite extensions are shared libraries or DLLs that can be loaded into SQLite at runtime to add new features, such as user-defined functions, virtual tables, or custom collating sequences. These extensions allow SQLite, and now rqlite, to support a wide range of additional functionality, beyond the built-in capabilities of the core database engine.
Installing extensions
Let’s walk through some simple demonstrations of using SQLite extensions with rqlite.
sqlean
Anton Zhiyanov has put together a curated set of SQLite extensions. With rqlite 8.27 it’s now easy to load those extensions into rqlite. Start by downloading the latest release of sqlean:
curl -L https://github.com/nalgeon/sqlean/releases/download/0.27/sqlean-linux-x86.zip
Next, pass the extensions archive to rqlite at launch-time:
rqlited -extensions-path=sqlean.zip data
That’s it! Now rqlite can take advantage of all this new functionality. Let’s check it out by connecting to rqlite node using the rqlite shell:
127.0.0.1:4001> SELECT median(value) FROM generate_series(1, 99) +---------------+ | median(value) | +---------------+ | 50 | +---------------+
sqlite-vec
Let’s try out a Vector Search extension from Alex Garcia:
curl -L https://github.com/asg017/sqlite-vec/releases/download/v0.1.1/sqlite-vec-0.1.1-loadable-linux-x86_64.tar.gz -o sqlite-vec.tar.gz
Again, pass the extension to rqlite at launch-time:
rqlited -extensions-path=sqlite-vec.tar.gz data
And now we can execute the functions from the extension:
127.0.0.1:4001> CREATE VIRTUAL TABLE vec_examples USING vec0(sample_embedding float[8]) 1 row affected
Combine this extension with rqlite’s clustering and now you’ve got a highly-available, fault-tolerant Vector Search system. Pretty cool, huh?
Next steps
With the addition of support for SQLite extensions, rqlite v8.27.0 opens the door to a wide range of new use cases and enhancements. Whether you need advanced cryptographic functions, specialized text processing, or additional data types, SQLite extensions can now be seamlessly integrated into your rqlite deployments.
Looking forward, I hope the community explores the extensive library of SQLite extensions available through projects like sqlean and beyond. As always, feedback and contributions are welcome.
For more detailed instructions on using extensions with rqlite, consult the official documentation and join the rqlite Slack channel for discussions, support, and collaboration.