ExperimentalEmbedded and remoteAGPL-3.0

A strongly typed
relational database core.

NetbaDB is a strongly typed relational database core written in Rust. Create a local Heap or LSM file with the embedded SDK, or start netbadbd and connect with Protocol v1 or the experimental PostgreSQL endpoint.

Phase 73Current release
Protocol v1Remote protocol
IndexScanRegistered indexes
MSRV 1.85.0dev 1.97.1

Current status

Experimental, with a defined implementation scope.

The query language is a limited native subset. The project is a compilable and testable Rust workspace with crash recovery, not a design-only prototype.

Implemented

  • Embedded Database API and netbadb-sdk re-exports
  • SELECT, INNER JOIN, INSERT / UPDATE / DELETE, ORDER BY, GROUP BY, aggregates, CREATE/DROP TABLE, CREATE/DROP INDEX
  • Registered indexes, DML maintenance, point and range IndexScan, ANALYZE
  • HashJoin, NestedLoopJoin, and costed Index Nested-Loop Join after ANALYZE
  • Read Committed and Repeatable Read; heap MVCC, vacuum, and multi-storage atomic commit
  • RANGE partitions and synchronous LSM table storage

Out of scope

  • Serializable isolation, concurrent writers, and cross-process file locking
  • SQL ALTER TABLE, PRIMARY KEY / UNIQUE / FK constraints, and index-only scans
  • Full SQL: outer joins, subqueries, HAVING, DISTINCT, window functions
  • External sort spill, simultaneous native and PostgreSQL listeners
  • PostgreSQL ALTER TABLE, complete pg_catalog, and password/TLS authentication for pgwire
  • MCP adapter (deferred past MSRV), SQL EXPLAIN, and on-disk format migrations

Planned

  • Serializable isolation — Serializable isolation, concurrent writers, and broader join enumeration remain later work.
  • MCP adapter — Deferred: official MCP SDKs currently exceed the Rust 1.85 MSRV.
  • Further optimization — SQL ALTER TABLE, one-sided/Text range costing, and broader HashJoin eligibility.

Get started

Three supported entry points.

Most applications should start with the embedded SDK. Use netbadbd when another process needs a Protocol v1 connection. Use the CLI to inspect catalogs and plans without executing SQL.

Embedded Rust

Add netbadb-sdk, create a table file, insert rows, and run SQL in-process.

Get started

Server and remote client

Start netbadbd from a deployment manifest, then connect with Rust or Go.

Get started

Offline inspection

Open existing files with the netbadb CLI to print catalog metadata or a physical plan.

Get started

Architecture

Stable layer boundaries.

Application languages are not part of the database's persistent meaning. Rust provides embedded and remote APIs. Go uses an independent Protocol v1 client and generated typed bindings.

Schema IRLanguage-independent tables, columns, physical / semantic types
Parser / HIRName resolution and nominal type checking
PlannerSeqScan, IndexScan, NestedLoopJoin, HashJoin, IndexJoin
ExecutorSynchronous and bounded-batch execution
StorageHeap MVCC, LSM, partitions, WAL, coordinator
Protocolnetbadbd, Protocol v1, experimental PostgreSQL v3

Nominal types

Identical u64 encodings remain distinct types.

UserId and TeamId may share a physical representation, but their nominal semantic types remain distinct. Storage encodes physical values. Canonical Schema is the source of semantic meaning.

Physical and semantic types

Internal identifiers are newtypes: TableId, RelationBindingId, ColumnId, PageId, RowId. In a self join, two aliases of the same table remain two bindings.

Schema identity on open

Every validated table has a versioned canonical byte encoding and a SHA-256 fingerprint. Heap metadata persists it; reopen requires the caller's full table identity, including semantic types and column order.

Documentation

Create a database in a few lines.

The Get started page covers the embedded SDK, indexes, netbadbd, and remote clients. Source code: github.com/sskycn/netbadb