https://github.com/appleweiping/cmu-15445-bustub
CMU 15-445 BusTub: a disk-oriented DBMS in C++ — buffer pool, B+tree index, query execution, concurrency control
https://github.com/appleweiping/cmu-15445-bustub
btree bustub cmu-15445 cpp csdiy database
Last synced: about 6 hours ago
JSON representation
CMU 15-445 BusTub: a disk-oriented DBMS in C++ — buffer pool, B+tree index, query execution, concurrency control
- Host: GitHub
- URL: https://github.com/appleweiping/cmu-15445-bustub
- Owner: appleweiping
- License: mit
- Created: 2026-07-07T11:33:22.000Z (10 days ago)
- Default Branch: main
- Last Pushed: 2026-07-07T15:10:43.000Z (10 days ago)
- Last Synced: 2026-07-07T15:15:31.940Z (10 days ago)
- Topics: btree, bustub, cmu-15445, cpp, csdiy, database
- Language: C++
- Size: 6.05 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CMU 15-445 BusTub — Disk-Oriented DBMS in C++
> A relational database management system built from the official BusTub skeleton — an independent,
> from-skeleton implementation of **CMU 15-445/645 — Database Systems** (Carnegie Mellon University,
> Fall 2023), part of a [csdiy.wiki](https://csdiy.wiki/) full-catalog build.
-brightgreen)


> The original upstream BusTub README is preserved as [`README_BUSTUB.md`](README_BUSTUB.md).
## Overview
BusTub is a disk-oriented relational DBMS used to teach CMU's database systems course. This repo
implements every project of the **Fall 2023** semester on top of the official
[`cmu-db/bustub`](https://github.com/cmu-db/bustub) skeleton (tag `v20231227-2023fall`):
- **P0** — a copy-on-write Trie key-value store, a thread-safe `TrieStore`, and the `upper`/`lower`
SQL scalar functions (with planner wiring).
- **P1** — the storage / buffer-management layer: an LRU-K replacer, a disk scheduler with a
background worker thread, and the buffer pool manager.
- **P2** — a disk-backed **extendible hash index**: RAII page guards, the header/directory/bucket
pages, and the full extendible hashing container (grow/split/merge, latch crabbing).
- **P3** — the **query execution engine**: all access-method, join, aggregation, and sort/limit/topn
executors plus the window-function executor, and three optimizer rules.
- **P4** — **multi-version concurrency control (MVCC)**: timestamps, an O(log N) watermark, tuple
reconstruction, MVCC scans, versioned insert/update/delete with undo logs, commit, garbage
collection, transaction abort, and primary-key index maintenance.
Every project is verified against the course's own test harness (the shipped gtest suites and the
`bustub-sqllogictest` runner). All captured outputs live in [`results/`](results/).
## Results (measured on Ubuntu 24.04 WSL2, g++ 13.3, CMake Release, 12 threads)
| Project | What it implements | Result (measured) |
|---|---|---|
| **P0** C++ Primer | COW Trie, TrieStore, upper/lower | `trie_test` 14/14, `trie_noncopy` 1/1, `trie_store` 4/4, `trie_store_noncopy` 2/2, `p0.01-lower-upper.slt` pass |
| **P1** Buffer Pool Manager | LRU-K replacer, disk scheduler, BPM | `lru_k_replacer_test` 1/1, `disk_scheduler_test` 1/1, `buffer_pool_manager_test` 2/2 |
| **P2** Extendible Hash Index | page guards, htable pages, extendible hashing | `page_guard_test` 1/1, `extendible_htable_page_test` 2/2, `extendible_htable_test` 3/3, `extendible_htable_concurrent_test` 6/6 |
| **P3** Query Execution | 12 executors + 3 optimizer rules | **21/21** official `p3.NN-*.slt` sqllogictest files pass |
| **P4** Concurrency Control | MVCC timestamps/scan/DML/GC/abort/PK-index | `txn_timestamp_test` 2/2, `txn_scan_test` 2/2, `txn_executor_test` 10/10, `txn_index_test` 5/5, concurrent-insert pass |
Total verified: **P0** 21 gtests + 1 slt, **P1** 4 gtests, **P2** 12 gtests, **P3** 21 slt files,
**P4** 19 serial gtests + concurrent-insert. See [`results/`](results/) for the raw run logs.
### P3 query execution — all 21 official sqllogictests pass
```
PASS p3.00-primer PASS p3.07-simple-agg PASS p3.14-hash-join
PASS p3.01-seqscan PASS p3.08-group-agg-1 PASS p3.15-multi-way-hash-join
PASS p3.02-insert PASS p3.09-group-agg-2 PASS p3.16-sort-limit
PASS p3.03-update PASS p3.10-simple-join PASS p3.17-topn
PASS p3.04-delete PASS p3.11-multi-way-join PASS p3.18-integration-1
PASS p3.05-index-scan PASS p3.12-repeat-execute PASS p3.19-integration-2
PASS p3.06-empty-table PASS p3.13-nested-index-join PASS p3.20-window-function
```
## Implemented assignments
- [x] **P0 — C++ Primer** — copy-on-write `Trie::Get/Put/Remove` with structural sharing; thread-safe
`TrieStore` (snapshot-read, single-writer); `StringExpression` upper/lower + planner `PlanFuncCall`.
- [x] **P1 — Buffer Pool Manager** — LRU-K replacer (backward k-distance, +inf for