Skip to content

Taliii7/mini-SGBD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🗄️ Mini-DBMS: High-Performance Database Engine

A custom-built relational Database Management System (DBMS) written in Java. This project implements the core components of a database engine from scratch, focusing on low-level memory management, disk paging, and query execution operators.

Java Maven Architecture License

📖 Project Overview

This engine simulates the internal behavior of systems like PostgreSQL or MySQL. Unlike high-level SQL applications, this project handles the physical storage of data, buffer pooling, and the algorithmic implementation of relational operators (Selection, Projection, Join).

Key Technical Features:

  • Page-Oriented Storage: Data is stored in binary pages (fixed size) managed directly on the disk.
  • Buffer Management: Implementation of a Frame Pool with replacement policies (LRU/Clock) to optimize I/O cost.
  • Query Execution Engine: Implementation of Volcan-style iterators (IRecordIterator) for pipelined query processing.
  • Heap Files: Management of free slots and record serialization.

🏗️ System Architecture & Code Structure

The codebase follows a strict layered architecture, separating physical storage from logical query processing.

graph TD;
    A["Client / CLI"] --> B["requete (DBManager)"];
    B --> C["relationnel (Relations & Records)"];
    C --> D["buffer (BufferManager)"];
    D --> E["espaceDisque (DiskManager)"];
    E --> F[("Disk Storage")];
Loading

📂 Repository Organization

Based on the src/main/java structure:

  • espaceDisque/ (Disk Manager Layer)

    • Handles the physical allocation/deallocation of Pages (PageId, DiskManager).
    • Manages persistent storage in .db files.
    • Implements low-level iterators (PageDirectoryIterator).
  • buffer/ (Buffer Management Layer)

    • BufferManager: Acts as the cache between Disk and Memory. It manages "Frames" and handles page pinning/unpinning to minimize expensive disk access.
  • relationnel/ (Data Structure Layer)

    • Defines the schema and data representation.
    • Relation: Represents a table schema.
    • Record: Handles byte-level serialization/deserialization of tuples.
  • requete/ (Query Processor Layer)

    • DBManager: The main entry point for executing queries.
    • Condition: Evaluates WHERE clauses (filters).
    • ProjectOperator / JoinOperator: Implementation of relational algebra operators.
  • test/ (Unit Testing)

    • Comprehensive testing suite for each layer (DiskManagerTests, RelationTest, etc.) ensuring component reliability.

👥 Team & Credits

This project was developed as part of the Computer Science curriculum at Université Paris Cité.


⚡ Supported Operations

The engine supports a subset of SQL-like commands handled by the DBManager:

CREATE TABLE

Create a table with defined columns.

CREATE TABLE NomTable (NomCol1:TypeCol1, NomCol2:TypeCol2, ..., NomColN:TypeColN(size))

Rules :

  • Column names and types are separated by : with no spaces.

  • Keywords and table names are separated by a single space.

  • Example:

    CREATE TABLE Clients (ID:INT, Nom:STRING(50), Age:INT)

INSERT

Insert a tuple into a table.

INSERT INTO NomTable VALUES (val1, val2, ..., valn)

Rules :

  • Strings must be surrounded by quotes ("value").
  • Example:
    INSERT INTO Clients VALUES (1, "Alice", 25)

BULKINSERT

Insert data from a CSV file.

BULKINSERT INTO NomTable nomFichier.csv

SELECT

Retrieve data with or without conditions.

SELECT aliasRel.col1, aliasRel.col2, ... FROM NomTable aliasRel [WHERE condition]

Rules :

  • Conditions follow: col1 OP col2, where OP is on of =, <, >, <=, >=, <>.

  • Join example :

    SELECT c.Nom, o.Montant FROM Clients c, Commandes o WHERE c.ID = o.ClientID

    Additional Commands

  • Create a database :

    CREATE DATABASE NomDB
  • Select a database :

    SET DATABASE NomDB
  • List tables in the current database :

    LIST TABLES
  • Drop a table :

    DROP TABLE NomTable
  • List all tables :

    LIST DATABASES
  • Drop a database :

    DROP DATABASE NomDB

    Running the Program

This guide explains how to run the program on Linux or macOS. Make sure you are at the project root: projet-bdda.**


Requirements

1. Linux or macOS terminal

The script is compatible with these systems only.

2. Java installed

java -version

Script run.sh

Make run.sh executable (if needed)

chmod +x run.sh

Execution Modes

Le programme peut être lancé de deux manières différentes :

1. Run with the default config

In this mode, the program automatically uses file-config.json in the current directory.

./run.sh

2. Run with a custom config file

./run.sh path/to/config.json

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors