Skip to content
View motedb's full-sized avatar

Block or report motedb

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Maximum 250 characters. Please donโ€™t include any personal information such as legal names or email addresses. Markdown is supported. This note will only be visible to you.
Report abuse

Contact GitHub support about this userโ€™s behavior. Learn more about reporting abuse.

Report abuse
motedb/README.md

MoteDB

AI-native embedded multimodal database for embodied intelligence. Columnar storage engine with ACID transactions, vector search, full-text search, and spatial indexing โ€” in a single embedded library.

Rust License

Quick Start

use motedb::{Database, DBConfig};

// Create or open an embedded database
let db = Database::create("my_data")?;

// SQL with multimodal support
db.execute("CREATE TABLE products (
    id INT PRIMARY KEY AUTO_INCREMENT,
    name TEXT,
    price FLOAT,
    embedding VECTOR(128)
)")?;

// Fast batch insert
db.batch_insert("products", rows)?;

// Point query
let result = db.execute("SELECT * FROM products WHERE id = 42")?;

// Full-text search
db.execute("CREATE TEXT INDEX idx_name ON products(name)")?;
let results = db.execute("SELECT * FROM products WHERE MATCH(name) AGAINST('wireless')")?;

// Vector similarity search
db.execute("CREATE VECTOR INDEX idx_vec ON products(embedding)")?;
let neighbors = db.vector_search("idx_vec", &query_vector, 10)?;

// Spatial KNN (3D point cloud)
db.execute("CREATE SPATIAL INDEX idx_pos ON products(position)")?;
let nearby = db.ioctree_knn_query("idx_pos", &point, 5)?;

Performance

Benchmark: 300K rows ร— 4 columns on Apple Silicon M-series vs SQLite 3.x WAL mode.

Operation MoteDB SQLite Winner
INSERT 300K 125ms 85ms MoteDB (1.5x)
CREATE INDEX ร—2 30ms 90ms MoteDB (3x)
WHERE = 11ms 14ms MoteDB (1.3x)
ORDER BY LIMIT 2.6ms 6.5ms MoteDB (2.5x)
COUNT/SUM/AVG WHERE 2.8ms 14ms MoteDB (5x)
PK SELECT <1ฮผs 1ฮผs MoteDB
LIKE 13ms 10ms SQLite (1.3x)
DISTINCT 8.5ms 4.6ms SQLite (1.9x)
SELECT * 27ms 9.7ms SQLite (2.8x)

Memory: 257 B/row (vs SQLite 369 B/row โ€” 30% less)

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                     MoteDB                           โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  SQL     โ”‚  Vector  โ”‚  Text    โ”‚  Spatial          โ”‚
โ”‚  Parser  โ”‚  DiskANN โ”‚  FTS     โ”‚  i-Octree         โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚              Columnar Storage Engine                 โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚  โ”‚ WAL     โ”‚โ†’ โ”‚ Columnar โ”‚โ†’ โ”‚ Columnar SSTable    โ”‚ โ”‚
โ”‚  โ”‚ (fsync) โ”‚  โ”‚ Buffer   โ”‚  โ”‚ (mmap + Snappy)     โ”‚ โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  MVCC Transaction โ”‚ Snapshot Isolation โ”‚ Conflict  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  • Storage: Columnar SSTable with Snappy compression, mmap zero-copy access
  • Write Path: WAL (durability) โ†’ columnar buffer โ†’ auto-finalize โ†’ SSTable
  • Read Path: SelectColumnar (zero-materialization), typed array access, predicate pushdown
  • Transactions: VersionStore MVCC with snapshot isolation and conflict detection

Features

Multimodal

Modality Index Query
Tabular Column Value (B-tree) WHERE, ORDER BY, GROUP BY
Vector DiskANN (Vamana graph) ORDER BY col <-> query LIMIT k
Text FTS (Inverted Index) WHERE MATCH(col) AGAINST('query')
Spatial i-Octree (3D) ST_DISTANCE, KNN, radius search

Embedded Optimized

  • Low memory: 257 B/row (30% less than SQLite)
  • Zero-copy reads: mmap with on-demand page loading
  • Fast writes: Zero-encode columnar INSERT (2.4M rows/s)
  • Small disk: Snappy compression (~1.8x, 68 B/row)
  • No daemon: Single library, embedded directly

ACID

  • Atomic: WAL-based crash recovery
  • Consistent: PK uniqueness, NOT NULL, type coercion
  • Isolated: MVCC snapshot isolation
  • Durable: WAL fsync + auto-finalize

Installation

cargo add motedb

Or in Cargo.toml:

[dependencies]
motedb = "0.3"

Configuration

use motedb::DBConfig;

// Edge device (low memory, periodic fsync)
let config = DBConfig::for_edge();

// Robotics (fast writes, vector support)
let config = DBConfig::for_robotics();

// Custom
let config = DBConfig {
    wal_config: WALConfig { durability_level: DurabilityLevel::GroupCommit { max_interval_ms: 10 }, .. },
    lsm_config: LSMConfig { memtable_size: 1 * 1024 * 1024, .. },
    ..DBConfig::for_edge()
};
let db = Database::create_with_config("my_data", config)?;

License

MIT

Popular repositories Loading

  1. motedb motedb Public

    ๅ…จ็ƒ้ฆ–ๆฌพ้ขๅ‘ๅ…ท่บซๆ™บ่ƒฝๅœบๆ™ฏ็š„ AI ๅŽŸ็”ŸๅตŒๅ…ฅๅผๅคšๆจกๆ€ๆ•ฐๆฎๅบ“ใ€‚

    Rust 36 7

  2. HarnessBook HarnessBook Public

    From Prompt to Harness: An Engineering Methodology for AI Agents

    2