How cmu-db/bustub works
BusTub is an educational relational database with basic SQL and an interactive shell. The principal workflow accepts SQL, binds it, plans and optimizes it, then executes it against catalog-managed tables and indexes; transaction and storage components support that work. The tree and excerpts establish the major subsystems, but many planner/executor connections were not sampled, so those links are shown as unverified rather than asserted. The README also identifies the shell as a product capability; build, grading, and development tooling are omitted.
Main entry points: transaction_manager.cpp Transaction manager · catalog.h Catalog and indexes · table_heap.cpp Tables and tuples · shell.cpp Interactive shell
Components 16
SQL processing
- Interactive shell
tools/shell/shell.cpp - Database instance
src/common/bustub_instance.cpp - SQL binder
src/binder/bind_select.cpp - Query planner
src/planner/planner.cpp - Plan optimizer
src/optimizer/optimizer.cpp
Query runtime
- Execution engine
src/include/execution/execution_engine.h - Query operators
src/execution
Data and storage
- Catalog and indexes
src/include/catalog/catalog.h - Tables and tuples
src/storage/table/table_heap.cpp - Buffer pool
src/buffer/buffer_pool_manager.cpp - Disk manager
src/storage/disk/disk_manager.cpp
Transactions and recovery
- Transaction manager
src/concurrency/transaction_manager.cpp - Lock manager
src/concurrency/lock_manager.cpp - Log manager
src/recovery/log_manager.cpp
Data types
- Types and values
src/type/value.cpp
Other components
- SQL user
Connections 16
- SQL user → Interactive shell: enters SQL
- Interactive shell → Database instance: submits queries
- Database instance → SQL binder: binds SQL
src/common/bustub_instance.cpp - SQL binder → Query planner: produces bound statements
- Query planner → Plan optimizer: builds plans
- Plan optimizer → Execution engine: supplies optimized plan
- Execution engine → Query operators: creates operators
src/include/execution/execution_engine.h - Query operators → Catalog and indexes: accesses metadata
- Catalog and indexes → Tables and tuples: owns table heaps
src/include/catalog/catalog.h - Catalog and indexes → Buffer pool: uses buffer pool
src/include/catalog/catalog.h - Buffer pool → Disk manager: loads and flushes pages
- Transaction manager → Catalog and indexes: uses catalog
src/concurrency/transaction_manager.cpp - Transaction manager → Tables and tuples: tracks tuple versions
src/concurrency/transaction_manager.cpp - Transaction manager → Lock manager: coordinates locking
- Transaction manager → Log manager: uses log manager
- Tables and tuples → Types and values: stores typed tuples