Skip to content

Repository files navigation

SimpleDB

Overview

Rust implementation of basic SQL database, originally implemented in Java by the Edward Sciore's book "Database Design and implementation".

SQL

simpledb is a database engine that can handle a subset of SQL. The following is the examples of commands which can be accepted by simpledb.

-- Creating tables
CREATE TABLE users(id INT, name VARCHAR(16));
-- Insertions
INSERT INTO users(id, name) VALUES(1, 'User');
-- Queries
SELECT u.id, u.name FROM users u where u.id=1;
-- Removal
DELETE FROM users WHERE id=1;
-- Updating
UPDATE users SET name='Other' WHERE id=1;
-- Index creation
CREATE INDEX users_ids ON users(id);
-- View for joins
CREATE TABLE salaries(user_id INT, amount INT);
CREATE VIEW users_salaries AS select id, amount FROM users, salaries WHERE id=user_id;

Features

Book Chapter Feature Implemented
3 File Manager ✔️
4 Log Manager ✔️
4 Buffer Manager ✔️
5 Recovery Manager ✔️
5 Concurrency Manager ✔️
5 Transaction ✔️
6 Record Pages ✔️
6 Table Scans ✔️
7 Metadata Manager ✔️
8 Select Scans, Project Scans, Product Scans ✔️
9 Parser ✔️
10 Planner ✔️
11 Embedded JDBC Interface ✔️
11 Remote JDBC Interface
12 Static Hash Indexes
12 Btree Indexes ✔️
13 Materialization and Sorting ✔️
14 MultiBuffer Sorting/Product ✔️
15 Query Optimization ✔️

The Remote JDBC Interface and network interface is in development(DB_00003 branch)

Key differences

  • B-Tree Index - implemented as single file structure, without using the recursion on insert, get and delete
  • JOINs - can be executed in two types of queries SELECT a, b FROM a, b and SELECT a, b FROM a JOIN b ON a = b

Getting started

Build

Clone this repository

cargo build --release

Then the executables will be generated in the target/release folder.

Usage

cd target/release

./cli

About

A Rust version of SimpleDB originally written in Java by Edward Sciore. The structure of SimpleDB is explained in detail in the book Database Design and Implementation.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages