Skip to content

anubhav100rao/mini_db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MiniDB - The Go Database Engine

Status License

MiniDB is a lightweight, transactional, SQL-compliant database engine written in Go. Based on the LSM Tree (Log-Structured Merge Tree) architecture, it is designed for educational purposes to demonstrate core database internals including MVCC, WAL, compaction, and query execution.

🚀 Key Features

  • Storage Engine: LSM Tree (MemTable + SSTables) optimized for write-heavy workloads.
  • Durability: Write-Ahead Logging (WAL) ensures data is never lost, even after a crash.
  • Transactions: Full ACID support with Snapshot Isolation using Multi-Version Concurrency Control (MVCC).
  • SQL Support: Custom parser and execution engine supporting SELECT, INSERT, and WHERE clauses.
  • Indexing: Hash Index support for O(1) primary key lookups.
  • Compaction: Background merging of SSTables to reclaim space and improve read performance.
  • Interfaces: Interactive CLI (REPL) and TCP Server mode.

📦 Getting Started

Prerequisites

  • Go 1.20 or higher

Installation

Clone the repository and build using Make:

git clone https://github.com/yourusername/minidb.git
cd minidb
make build

Running the Database

1. Interactive Mode (REPL)

make run

Or manually: ./minidb

Example Session:

minidb> HELP
minidb> SHOW TABLES
Tables:
users
(1 rows)

minidb> DESCRIBE users
Table: users
Column | Type
-------+-----
id     | int
name   | string

minidb> INSERT INTO users VALUES (1, 'Alice')
minidb> SELECT * FROM users WHERE id = 1
[1 Alice]

2. Server Mode

make server

Or manually: ./minidb -server -port 3000

Testing

Run all tests:

make test

📚 Documentation

Detailed documentation is available in the docs/ directory:

🧪 Testing

Run the comprehensive test suite to ensure everything is working:

go test ./...

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors