MagnumDB Engine
Experimental / Alphav0.4.8MIT LicenseRust Engine

MagnumDB Database Project

MagnumDB is an open-source database engine built in Rust for exploring storage engines, SQL execution, transactions, Write-Ahead Logging (WAL) durability, MVCC, and database internals.

Technical Project Status & Metadata
PROJECT STATUS
Experimental / Alpha
CURRENT VERSION
0.4.8
LANGUAGE
Rust
LICENSE
MIT License
PROTOCOL
PostgreSQL Wire Protocol
DEPLOYMENT MODES
Embedded + Standalone Server
Engine Overview

What is MagnumDB?

MagnumDB is an experimental embedded KV and SQL database engine written in clean, idiomatic Rust. It combines core database engine components into an inspectable, self-contained codebase.

Disk-backed B+ Tree page storage engine
Append-only Write-Ahead Logging (WAL) durability
Startup log replay crash recovery
Least Recently Used (LRU) buffer pool manager
SQL Lexer, Parser, and AST Generator
Volcano iterator query execution engine
Atomic Transactions (BEGIN, COMMIT, ROLLBACK)
Multi-Version Concurrency Control (MVCC)
Read Committed transaction snapshot isolation
PostgreSQL wire protocol TCP server support
Primary Purpose: MagnumDB exists to make database internals understandable, inspectable, and modifiable.
Editorial Motivation

Why MagnumDB?

MagnumDB addresses three distinct workflows for database enthusiasts and systems developers.

01. LEARN

Understand Database Internals

Understand how storage engines, transactions, Write-Ahead Logging (WAL), B+ Trees, and query execution work underneath high-level SQL abstractions.

02. BUILD

Embed Inside Rust Apps

Use MagnumDB as an embedded database engine inside Rust desktop software, local-first applications, and command line utilities requiring local data storage.

03. EXPERIMENT

Hack & Research Infrastructure

Modify the engine, experiment with page sizes or cache replacement algorithms, and study how database systems are implemented in memory-safe Rust.

Application Scope

What can you use MagnumDB for?

  • Educational database projects and academic coursework
  • Embedded relational or KV storage inside Rust applications
  • Local-first desktop software and offline CLI tools
  • Developer tools and local test harness environments
  • Database internals research and storage engine experiments
  • Custom SQL query planner or executor algorithm prototyping
  • Systems programming learning projects in Rust
Notice: MagnumDB is not recommended for production use yet.
Technical Specification

Features

FeatureDescriptionDocumentation
B+ TreeDisk-backed B+ Tree storage engine with slotted 4 KB pages.Docs
WALAppend-only Write-Ahead Logging for crash recovery durability.Docs
Buffer PoolLRU page frame manager with pinning and dirty writeback.Docs
MVCCMulti-Version Concurrency Control with xmin/xmax versioning.Docs
TransactionsBEGIN, COMMIT, ROLLBACK statements under Read Committed isolation.Docs
SQL EngineRelational query execution supporting DDL, DML, JOINs, and CTEs.Docs
PostgreSQL ProtocolWire-protocol TCP server support for psql and Postgres drivers.Docs
Embedded ModeDirect in-process Rust API access via Database, Config, Executor.Docs
Server ModeStandalone TCP process listening on port 5432.Docs
Engine Topology

Architecture Overview

Explore Full Architecture Specifications
Application / Client (psql or Rust binary)
MagnumDB API & Postgres Protocol Server
KV Engine
Key-Value API Interface
SQL Engine
Parser & Volcano Executor
B+ Tree Index & MVCC Tuple Storage
LRU Buffer Pool Manager & 4 KB Pager
Write-Ahead Logging (WAL + fsync)
Primary Data Files & WAL Log on Disk
SQL Engine Reference

SQL Support Matrix

Open Technical SQL Reference Manual
SQL CommandSupport StatusExecution Notes
CREATE TABLESupportedSupports PRIMARY KEY, UNIQUE, NOT NULL, DEFAULT
INSERT INTOSupportedAppends tuples into B+ Tree slotted leaf pages
SELECTSupportedFiltering via WHERE clauses and binary expressions
UPDATESupportedCreates new tuple version with current xmin under MVCC
DELETESupportedMarks tuples as deleted by setting xmax transaction ID
DROP TABLESupportedDeallocates relation B+ Tree metadata and pages
ALTER TABLEADD COLUMN SupportedAppends new attribute to schema definition
JOININNER / LEFT SupportedEvaluated by Volcano physical join operators
GROUP BY & HAVINGSupportedAggregates tuple groups and filters calculated values
ORDER BY & LIMITSupportedSorts result sets and applies offset boundaries
CTEs (WITH clause)SupportedEvaluates named temporary CTE result streams
Window FunctionsROW_NUMBER SupportedEvaluates partition window frame functions
UNION / UNION ALLSupportedCombines query result streams
FOREIGN KEYParsed, NOT EnforcedSyntax parses cleanly, but referential integrity is not enforced
Foreign Key Constraint Disclaimer:

FOREIGN KEY syntax is parsed by the lexer for DDL script compatibility, but referential integrity constraints are NOT currently enforced by the query execution engine.

Developer Quick Start

Getting Started Preview

Open Complete 8-Step Tutorial

Integrating MagnumDB into your Rust project requires only adding the magnumdb crate dependency.

Add to Cargo.toml
$ cargo add magnumdb@=0.4.8

Once added, call Database::open(config) to initialize the disk pager and LRU buffer pool.

Read Cargo & Rust Installation Guide →
src/main.rs
rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use magnumdb::{Config, Database}; use magnumdb::sql::{Executor, Parser}; fn main() -> anyhow::Result<()> { // 1. Initialize database path and buffer pool let config = Config::default().with_path("./my_database"); let mut db = Database::open(config)?; // 2. Execute SQL query statements let mut exec = Executor::new(&mut db); let ast = Parser::parse("CREATE TABLE users (id INT PRIMARY KEY, name TEXT);")?; exec.execute(ast)?; Ok(()) }
Deployment Architecture

Embedded vs Server Mode

MagnumDB can be deployed as an in-process Rust library or as a standalone PostgreSQL wire protocol network server.

Embedded Mode

In-Process Library
  • Links directly into Rust binaries without managing external server processes.
  • Direct API access to Database, Config, and Executor.
  • Zero network socket IPC overhead for local data operations.

Server Mode

Standalone TCP Process
  • Runs standalone TCP listener accepting PostgreSQL frontend/backend wire protocol frames.
  • Connect via standard PostgreSQL client drivers and the psql CLI client.
  • Supports MD5 password challenge authentication negotiation for user principals.
Security Model & System Safeguards

Security Policy & Known Limitations

Read Complete Security Policy
MANDATORY OPERATIONAL DIRECTIVE:
DO NOT EXPOSE MAGNUMDB TO THE PUBLIC INTERNET.

MagnumDB does not implement TLS encryption or modern network hardening. Deploy strictly within local loopback interfaces (127.0.0.1) or isolated development networks.

No TLS Encryption

Network socket communication over TCP port 5432 is unencrypted plaintext.

MD5 Authentication

Password verification uses legacy MD5 challenge responses without SCRAM-SHA-256.

Default Superuser Privilege

The default postgres role operates with full superuser permissions without RBAC scoping.

Read Committed Isolation

Snapshot isolation is limited to Read Committed. Non-repeatable reads may occur.

Serialized Commit Writes

Transaction commits acquire exclusive write locks, serializing throughput.

Unenforced Foreign Keys

FOREIGN KEY clause syntax parses, but referential integrity constraints are not enforced.

Engine Benchmarking

Performance

MagnumDB does not currently publish comparative benchmark results.

Insert Throughput

Sequential & random tuple insertion rate

[ Pending Release ]
Point Reads

Key-based point lookup latency

[ Pending Release ]
Sequential Scans

Leaf page range scan bandwidth

[ Pending Release ]
Concurrent Clients

Multi-client socket scaling & lock contention

[ Pending Release ]
Transaction Throughput

WAL commit fsync & write operations

[ Pending Release ]
Query Latency

Expression evaluation & Volcano iterator overhead

[ Pending Release ]
Memory Usage

LRU buffer pool footprint & page frame bounds

[ Pending Release ]
Storage Overhead

Slotted page header space amplification

[ Pending Release ]
Benchmark methodology will be published alongside future results.
Engine Landscape

MagnumDB vs Other Database Engines

MagnumDB is positioned as an educational and experimental engine for studying database implementation techniques.

EnginePrimary PurposeEmbeddedSQLKVWALMVCCWire ProtocolMaturity
MagnumDBDatabase Internals EducationYesSubsetYesYesRead CommittedPostgreSQLAlpha / Experimental
SQLiteEmbedded Relational StorageYesFullNoYes (WAL Mode)No (Lock-based)NoneProduction Stable
PostgreSQLPrimary Application RDBMSNoFull (ANSI)JSONBYes (pg_wal)Full MVCCNative PostgreSQLEnterprise Production
RocksDBLSM Key-Value StoreYesNoYesYesSequence NumbersNoneHigh-scale Production
redbEmbedded Rust KV StoreYesNoYesCopy-on-WriteNo (CoW B-Tree)NoneStable Rust Crate
Development Directions

Roadmap & Project Status

Implemented Features (v0.4.8)

  • Embedded Rust library API (Database, Config, Executor)
  • Fixed 4 KB page disk pager and slotted page layout
  • B+ Tree engine with internal node splits & leaf overflow pages
  • Write-Ahead Logging (WAL) with CRC32 checksums & fsync
  • Startup WAL replay crash recovery
  • LRU buffer pool manager with page frame pinning
  • MVCC with xmin / xmax versioning and Read Committed isolation
  • Volcano-style query executor (open, next, close)
  • Rule-based SQL query planner & AST generator
  • PostgreSQL wire protocol TCP server & psql CLI compatibility

Planned Future Milestones

Note: Planned milestones represent future research goals and are not implemented in version 0.4.8.

  • WAL Checkpointing (Periodic fuzzy checkpointing to truncate log replay length)
  • TLS / SSL Socket Encryption for Server Mode
  • Differential Fuzz Testing against SQLite & PostgreSQL test suites
  • Foreign Key Referential Integrity Enforcement
  • SCRAM-SHA-256 Password Authentication
  • Repeatable Read & Snapshot Isolation Modes
  • Query Optimization Predicate Pushdown Rules
  • Comparative Performance Benchmarking Suite
Open Source Development

Community & Contributing

MagnumDB development, architectural discussions, and issue tracking occur transparently on GitHub.

Project Creator

Built by Soham Das

MagnumDB is built and maintained as an open-source database project developed under the Blobly ecosystem, focused on database internals, storage engines, SQL, transactions, and systems programming in Rust.

@sohamdev77