SwatDB is a relational database management system (DBMS) and courseware project built at Swarthmore College for the Database Systems (CPSC 44) course.

SwatDB is designed to teach the internal mechanics of database systems through direct implementation. SwatDB is aimed at a systems-level understanding of a database; its core contribution is its layered architecture, which guides students through the implementation of a full DBMS stack. Current lab assignments challenge students to build critical components from the ground up, including layers for file storage, memory management, and fundamental relational operators. By going "under the hood" and utilizing a programming-level interface, SwatDB provides students a deep, functional understanding of how data is stored, buffered, and processed.

SwatDB has been integrated in the Swarthmore College Computer Science curriculum since 2020, serving as the core deliverables for an upper-level Database Systems course. SwatDB is in part inspired by similar DBMS Courseware like minibase by Raghu Ramakrishnan and Johannes Gehrke.

1. Key System Features

  • Layered DBMS Architecture: implements a full DBMS layered system from Relational Operators down to a Disk Manager.

  • Programming-Level Interface: Prioritizes "under-the-hood" learning by requiring students to interact with internal layer functions directly rather than through a traditional SQL user interface. This exposes students to low-level data management and memory allocation, which are often abstracted away by the SQL layer.

  • Storage and Indexing Capabilities: Provides robust management for Heap Files and Hash Indices, with ongoing development for B+ Tree Indices and sorted files.

  • Advanced Relational Operators: Supports a variety of algorithms for selects and joins, including nested loop joins and both sequential and parallel hash joins.

  • Systems-Oriented Programming Environment: Developed in C++ (utilizing a focused subset to emphasize DBMS logic) and optimized for Linux systems using standard tools like GCC, Make, and Doxygen.

2. Contributions to CS Education

  • Integrated Curricular Sequence - A Layer-by-Layer DBMS Implementation: Provides several assignments where students implement critical internal components, including buffer management replacement algorithms, heap file structures, and relational operators like select, project, and join.

  • Comprehensive Instructor Toolkit: Assignments come packaged with automated testing infrastructure, API documentation, example grading rubrics, detailed assignment write-ups, and setup instructions.

  • Scaffolded Structure: SwatDB is explicitly designed to be easier for students to debug while focusing on architectural logic. Examples include a thorough exception library and documentation to verbosely flag errors; simplified unit tests with distinct purposes and gradual advancement to support iterative development and testing; verbose documentation that makes the API clear but also enumerates causes for various exceptions and errors.

  • Undergraduate Research Mentorship: Facilitated meaningful research opportunities and technical contributions from five undergraduate students since the project’s inception in 2020

  • Continued Development: SwatDB was started in the Summer of 2020, and continues to be under development as we add more features and functionality. In addition, assignments and infrastructure continue to be refined based on student feedback after each iteration of the course.

3. Dissemination

User experience surveys are being conducted with plans for formal documentation and dissemination of educational outcomes.

Currently SwatDB is not publicly available. It will never be fully released as open source because it is primarily designed as courseware. However, we plan to release SwatDB to instructors teaching DBMS courses under a user agreement.

4. SwatDB Structure

SwatDB is implemented using a layered architecture as shown in this figure:

SwatDB

The layers include:

  • Disk Manager: manages SwatDB stored data on disk, and implements an interface to create/delete a DB file and to allocate/deallocate, read/write Pages from disk. (Note: Disk Manager maps SwatDB Files to the underlying Unix File System),

  • Buffer Manager: manages SwatDB main memory as a Buffer Pool of Pages, and implements an interface to higher layers for accessing Pages of Memory, including: allocate/deallocatePage, get/release/flushPage.

  • File Manager: manages files and indices in SwatDB. Its main interface is to create/delete a File or Index. Current types supported:

    • Heap File

    • Hash Index

    • B+ Tree Index (under development)

  • Relational Operator Manager: implements operations on stored DB files and indices in response to a query. It is the interface to several select and join algorithms:

    • Selects: scan, index

    • Nested Loop Joins: tuple, page, index

    • Hash Joins: sequential, parallel

  • SwatDB: serves as the top-level layer of the system. It provides interface methods for initializing the system and accessing the main parts of the system.

In addition to these layers, there is one SwatDB module that is used by all layers of the system:

  • Catalog: keeps state about the stored DB in the system, including Schema for all stored relation and index files, and internal data for accessing their file data.

4.1. Future Development

  • A layer on top of Relational Operators to run a simple query plan consisting of several relational operations

  • Expand the SwatDB layer to include a richer user interface.

  • Expand the set of relational operator algorithms

  • B+ Tree Index (currently under development)

  • Sorted File

5. People

  • Principal Investigators:

  • Students:

    • Yara Shobut '27

    • Tillie Ferguson '23

    • Seth Keim '23

    • Keonwoo Oh '21

    • Herbert Rand '21