Expand description
§VelociDB
VelociDB is a high-performance, embedded database engine written in Rust. It features a modern architecture designed for NVMe storage and multi-core systems.
§Key Features
- Vector search:
F32_BLOB(n)columns,vector32('[...]')literals andvector_distance_cos/l2/dotfunctions with exact, parallel KNN (ORDER BY vector_distance_cos(...) LIMIT k). - Async API: Turso-style
Builder/AsyncDatabase/AsyncConnectionbuilt on tokio (async_apimodule,async-iofeature). - Parallel execution: rayon-parallel WHERE filtering, ORDER BY sorting, and vector distance computation for larger row sets.
- Change Data Capture: real-time tracking of INSERT/UPDATE/DELETE with
sequence numbers (
Database::enable_cdc/changes_since). - Schema management:
ALTER TABLEADD/DROP/RENAME COLUMN and RENAME TO.
§Quick Start
use velocidb::Database;
// Open a database (creates it if it doesn't exist)
let db = Database::open("my_database.db")?;
// Create a table
db.execute("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, age INTEGER)")?;
// Insert data
db.execute("INSERT INTO users VALUES (1, 'Alice', 30)")?;
db.execute("INSERT INTO users VALUES (2, 'Bob', 25)")?;
// Query data
let results = db.query("SELECT * FROM users WHERE age > 25")?;
for row in results.rows {
println!("Found user: {:?}", row.values);
}Re-exports§
pub use storage::Database;pub use types::QueryResult;pub use types::Value;pub use types::Row;pub use types::Column;pub use vector::DistanceMetric;pub use cdc::CdcManager;pub use cdc::ChangeEvent;pub use cdc::ChangeOp;pub use async_api::AsyncConnection;pub use async_api::AsyncDatabase;pub use async_api::Builder;pub use mvcc::MvccManager;pub use mvcc::Snapshot;pub use mvcc::VersionedRecord;pub use async_io::AsyncPager;pub use async_io::AsyncVfs;pub use async_io::TokioVfs;pub use async_io::BatchIoExecutor;pub use lockfree::LockFreePageCache;pub use lockfree::LockFreeIoQueue;pub use lockfree::LockFreeCounter;pub use simd::VectorBatch;pub use simd::VectorizedFilter;pub use simd::VectorizedAggregation;pub use btree_optimized::CacheOptimizedNode;pub use btree_optimized::CachePrefetcher;pub use crdt::CrdtStore;pub use crdt::CrdtOperation;pub use crdt::SyncProtocol;pub use cloud_vfs::CloudVfs;pub use cloud_vfs::CloudVfsConfig;pub use hybrid_storage::HybridTable;pub use hybrid_storage::StorageLayout;pub use hybrid_storage::ColumnStorage;pub use pmem::DaxVfs;pub use pmem::PmemTransactionLog;
Modules§
- async_
api - Native async API, modeled on Turso’s Rust binding.
- async_
io - Asynchronous I/O layer for high-throughput storage.
- btree
- B-Tree index for primary key lookups and range scans.
- btree_
optimized - Cache-optimised B-Tree with 64-byte-aligned nodes and SIMD key search.
- cdc
- Change Data Capture (CDC), inspired by Turso’s real-time change tracking.
- cloud_
vfs - Cloud VFS backed by S3, Azure Blob, or Google Cloud Storage.
- crdt
- Conflict-free Replicated Data Types (CRDT) for offline-first sync.
- executor
- Query executor that translates AST statements into storage operations.
- hybrid_
storage - Hybrid row/columnar storage for mixed OLTP + OLAP workloads.
- lockfree
- Lock-free data structures for multi-core scalability.
- mvcc
- Multi-Version Concurrency Control (MVCC) with snapshot isolation.
- parser
- SQL parser supporting DDL (CREATE TABLE, DROP TABLE, ALTER TABLE), DML (INSERT, UPDATE, DELETE), and DQL (SELECT with WHERE, COUNT(*) aggregation, and vector distance expressions).
- pmem
- Persistent Memory (PMEM) VFS with Direct Access (DAX).
- simd
- Vectorized query execution using SIMD (AVX2 / AVX-512 / NEON).
- storage
- Storage engine layer: file-backed pager, database lifecycle, and schema management.
- transaction
- ACID transaction manager with two-phase locking and atomic state transitions.
- types
- Core type definitions for VelociDB.
- vector
- Vector search support (Turso / libSQL inspired).
- wal
- Write-ahead log (WAL) for crash recovery.