# SimpleDB

> A Java database course project with query operators, a buffer pool, page locks, and transaction handling. The code makes the storage work behind a query visible.

- Author: Benjamin Zhuang
- Category: Database internals
- Context: Database coursework · teaching framework
- Years: 2023
- Stack: Java, Page storage, Query operators, Transactions, JUnit
- Source: https://github.com/Benjaminnnnnn/simple-db
- Web page: https://benjaminnnnnn.github.io/portfolio/simple-db/

**Follow a query all the way down to a page.**

## Key figures

- 4 KiB: default page size in BufferPool
- Page locks: transaction access control
- Java: storage and query implementation

## The buffer pool sits between queries and disk.

BufferPool retrieves a page from its cache or reads it from the underlying file. When the configured pool is full, it evicts a page before admitting another. Page IDs and transaction permissions are explicit inputs.

## Commit and abort take different paths.

The implementation acquires locks before returning pages. A commit flushes the transaction's dirty pages; an abort restores its pages from disk. Both paths then release the transaction's locks.

## Coursework with concrete implementation details.

This repository includes a teaching framework and tests for operators, pages, writes, and deadlocks. It is a course implementation. The test suite has not been rerun for this case study, so no passing-test or throughput figure is attached.

## Evidence

- [Buffer pool implementation](https://github.com/Benjaminnnnnn/simple-db/blob/main/src/java/simpledb/BufferPool.java)
- [Repository and course tests](https://github.com/Benjaminnnnnn/simple-db)
