MilanSQL is a custom relational SQL database engine created entirely in C++17, offering rich features such as a TCP server, REST API, and full-text search. With zero external dependencies and a comprehensive SQL interface, this project is ideal for developers looking to understand database internals and create tailored database solutions.
MilanSQL is a custom relational SQL database engine developed entirely in C++17, designed to provide a robust, high-performance database solution with extensive features and zero external dependencies. This project has evolved through 117 development phases, showcasing a complete implementation of SQL functionalities coupled with modern architectural design.
Key Features
- Full SQL Support: Includes core CRUD operations (SELECT, INSERT, UPDATE, DELETE), calling of stored procedures, and support for complex queries through JOINs, subqueries, and window functions.
- Robust Transactions: Employs multi-version concurrency control (MVCC), write-ahead logging (WAL), and provides savepoints and transaction management.
- Dynamic Replication: Features both physical and logical replication options, ensuring data integrity and availability.
- Custom Networking Protocols: Supports multiple protocols, including TCP, MySQL Wire, PostgreSQL Wire, REST API, and GraphQL, making it flexible for various applications.
- Advanced Analytics: Offers built-in support for time-series data and efficient operations with features such as ARRAY aggregates and window functions.
Documentation
MilanSQL is accompanied by comprehensive documentation:
- SQL Reference: Detailed command reference covering all phases of development.
- Tutorial: A hands-on guide to getting started.
- Architecture: Insights into the internal workings of the engine, including its structure and components.
- Live Demo: Experience MilanSQL directly through a web-based demo.
Getting Started
MilanSQL can be quickly launched from the command line:
# Start the interactive REPL
git clone https://github.com/haidar9819-lang/milansql.git
cd milansql
cmake -B build -G Ninja && ninja -C build
./build/milansql.exe --http --port 8080
This command initiates the database server facilitating interactive SQL queries.
Client Drivers
MilanSQL provides client drivers for various programming languages, enhancing accessibility:
- Python:
pip install milansql - Node.js:
npm install milansql - Java: Use
com.milansql:milansql-jdbc:5.0.0 - Rust:
cargo add milansql - .NET:
dotnet add package MilanSQL.Data
Performance Benchmarking
MilanSQL v5.8.0 has shown impressive performance metrics:
| Metric | Result |
|---|---|
| INSERT throughput | ~98,000 rows/sec |
| SELECT scan | ~1M rows/sec |
| Index lookup | O(log n) B-Tree |
Overall, MilanSQL represents a significant step in custom database solutions, combining a powerful feature set with a lightweight framework conducive to both development and production use.
No comments yet.
Sign in to be the first to comment.