This project was developed for educational purposes only as part of my Database II course at the School of Computer Science - UNSA.
It is not intended for production use.
The implementation was built from scratch in C++ to understand how a Database Management System (DBMS) works internally.
This project was inspired by and based on the following materials:
- Course: Carnegie Mellon University - 15-445/645 Database Systems (Spring 2024)
- Book: Database System Concepts (7th Edition)
- Avi Silberschatz
- Henry F. Korth
- S. Sudarshan
- YouTube Playlist: CMU Database Systems
LittleDB is a miniature DBMS that implements the main building blocks of a database system, including:
- Buffer Manager
- Disk Manager
- Query Execution
- Storage Organization
- Indexing (B+ Tree)
- Interactive Console
It is designed to simulate how modern databases manage storage, memory, and queries.
- Creation of a custom disk structure
- Persistent storage with LOAD functionality to recover data between executions
- HeapFile management for free blocks
- Disk sector and block allocation for relations
- Frames with pinning/unpinning, dirty flags, and reference bits
- Page abstraction with support for adding/deleting records
- Replacement Policies:
- Least Recently Used (LRU)
- Clock Algorithm
- Functions to load, update, delete, and persist pages
- B+ Tree implementation supporting:
- Insertions
- Searches
- Deletions (leaf and internal nodes)
- DOT export for visualization
- DatabaseMediator to connect buffer, disk, and query layers
- Insert, select, and delete operations
- CSV import support
- Schema validation and management
- Execute SQL-like commands:
createTableinsertSchemaselectTableshowTablereadCSV
- Data visualization in memory (RAM view)
- Simple command validation
- When inserting into an empty table, the HeapFile allocates free blocks, and the B+ Tree assigns the first page to the buffer.
- The console shows the relation’s blocks and sectors.
- The system maintains persistence through the
LOADcommand. - Data modifications are reflected correctly on disk via the buffer manager.
-
Buffer Manager
insert→ loads and pins page, writes record, marks dirty, later flushed to diskdelete→ loads page, removes record, updates disk on flushselect→ loads required pages for query optimizationwhere→ evaluates conditions on loaded pages
-
Disk Manager
- Manages writing, deleting, and retrieving data blocks
- Ensures efficient organization of storage
- Keeps catalog and metadata updated
-
Indexing
- Accelerates queries via B+ Tree
- Maintains index consistency on insert/delete operations
This project is released under the GNU General Public License v3.0 (GPL-3.0).
Erick Malcoaccha (Natzgun)
Educational DBMS project - UNSA, Database II Course.
Focused on systems programming and database internals.
Erik Ramos
Main collaborator in the development of core components (Buffer Manager, B+Tree, Clock, etc.).
