What it is

plan is a single-node transactional database kernel prototype built around TPC-H, with a compute engine and a storage engine. It isn’t a product — it’s a testbed for how a kernel should be written.

LanguageGo
LicenseApache-2.0
Stars / Forks8 / 4
Open issues20
Last push2026-10-22
Repositorydaviszhen/plan

Snapshot at build time, not live.

Architecture

Both diagrams come from the repo’s book/ directory (Apache-2.0):

Storage engine

Compute engine

Modules

DirectoryResponsibility
parserSQL parsing, binding, expressions
computevectorized execution, operators, chunks
storagestorage engine (pages, indexes, transactions)
storage2next-generation storage engine (in progress)
chunkcolumnar memory layout
common / utiltypes, errors, utilities
cmd/plandbinteractive psql server
cmd/testernon-interactive TPC-H runner

Capabilities

  • create schema / create table
  • copy from parquet and CSV
  • insert ... values
  • all 22 TPC-H queries (via tester)

TPC-H 1g results

22/22 marked right; compared with DuckDB and MatrixOne (ignoring precision and headers):

ResultCount
identical to DuckDB16
differs from DuckDB (address/comment columns etc.)6
identical to MatrixOne20
known difference (q13: left join to inner join)1

The full table is in the repo README.

Documentation

  • 快速实现数据库内核: binding, CTE preprocessing, table-definition parsing, query planning (filter pushdown, join ordering, column pruning, reference counting, output expressions), vector/chunk execution;
  • STORAGE2_DEVELOPMENT_PLAN*: phased plans for the second storage engine;
  • storage-test-plan.md / storage2-tdd-plan.md: testing and TDD plans.

All in the repository.

Quick start

make plandb
./plandb
psql -h 127.0.0.1

make tester
./tester tpch1gddl --ddl "create table ..."

Known limits

  • Prototype; not production-ready;
  • 20 open issues;
  • storage2 is still evolving and its interfaces may change;
  • Covers the SQL subset TPC-H needs, not a full SQL engine.

Relation to this site

The database series here is about reading other kernels (optimizers, gporca, Lucene); this project is about building one. They inform each other.

Implementation series

The repo’s build notes distilled into posts: Building a database kernel.