Next-Generation RDBMS

Modern Database for AI & Analytics

A feature-complete, high-performance RDBMS with native AI/ML support, time-travel queries, adaptive compression, and enterprise securityβ€”all in one unified engine.

50K+
Lines of C++
95%+
Test Coverage
10K+
QPS
100GB+
Tested Data

Why LatticeDB?

Built from scratch in modern C++17, LatticeDB combines traditional database capabilities with cutting-edge features that major RDBMS don't provide natively out-of-the-box.

🎯

Complete SQL Support

Full SQL parser with DDL, DML, DCL, TCL. JOINs (INNER, LEFT, RIGHT), GROUP BY, aggregates (COUNT, SUM, AVG, MIN, MAX), subqueries, and CTEs all fully implemented.

⏰

Time Travel Queries

Built-in temporal support with FOR SYSTEM_TIME AS OF syntax. Query historical data at any point in time with bitemporal architecture.

πŸ€–

Native Vector Search

Fully implemented vector engine with Flat, HNSW, IVF algorithms and multiple distance metrics (L2, Cosine, Dot Product) for AI/ML workloads.

πŸ”’

Enterprise Security

Row-level security, column encryption (AES-256-GCM, ChaCha20), authentication (password, JWT, certificates), and comprehensive audit logging.

πŸ’Ύ

Advanced Storage

Professional buffer pool manager with LRU/Clock replacement, B+ Tree indexes, Write-Ahead Logging (WAL), and ARIES recovery.

⚑

ACID Transactions

Full MVCC implementation with multiple isolation levels, 2PL protocol, deadlock detection, and savepoints for reliable transactions.

πŸ—œοΈ

Adaptive Compression

Working compression engine with RLE, Dictionary, Delta, Bit-packing, LZ4, and ZSTD algorithms for optimal storage efficiency.

πŸ“Š

Stream Processing

Real-time continuous queries with windowing functions for streaming analytics and materialized views with backfill support.

Feature Matrix

LatticeDB provides features that major RDBMS generally don't offer natively, all unified in a single coherent engine.

Capability LatticeDB PostgreSQL MySQL SQL Server
Full SQL with JOINs, GROUP BY βœ… Built-in βœ… Built-in βœ… Built-in βœ… Built-in
Time Travel (FOR SYSTEM_TIME) βœ… Built-in Via extensions Limited Temporal tables
Native Vector Search βœ… Built-in pgvector ext Via plugins Limited
Row-Level Security βœ… Built-in βœ… Built-in Via views βœ… Built-in
Column Encryption βœ… Built-in Via extensions TDE only Always Encrypted
Adaptive Compression βœ… Built-in Basic Basic Advanced
Stream Processing βœ… Built-in Via extensions Via binlog CDC
Custom Merge Policies (CRDTs) βœ… Built-in Third-party Third-party Third-party
Built-in Web GUI βœ… Built-in Third-party Third-party Third-party

System Architecture

Modular, layered architecture with clear separation of concerns for extensibility and maintainability.

flowchart TD
    subgraph "Client Layer"
        GUI[Web GUI]
        CLI[CLI Client]
        SDK[SDKs]
    end

    subgraph "Query Engine"
        PARSE[SQL Parser]
        OPT[Query Optimizer]
        EXEC[Executor]
    end

    subgraph "Storage Layer"
        MVCC[MVCC Controller]
        ULS[Universal Log Store]
        IDX[B+ Tree & Vector Indexes]
    end

    subgraph "CRDT Engine"
        LWW[LWW Register]
        GSET[G-Set]
        COUNTER[PN-Counter]
    end

    subgraph "Security & Privacy"
        RLS[Row-Level Security]
        DP[Differential Privacy]
        AUDIT[Audit Logger]
    end

    GUI --> PARSE
    CLI --> PARSE
    SDK --> PARSE
    PARSE --> OPT
    OPT --> EXEC
    EXEC --> MVCC
    MVCC --> ULS
    ULS --> IDX
    EXEC --> RLS
    EXEC --> DP
    EXEC --> AUDIT
    ULS --> LWW
    ULS --> GSET
    ULS --> COUNTER
                

Query Processing Pipeline

flowchart LR SQL[SQL Query] --> Parser[Parser] Parser --> AST[AST] AST --> Analyzer[Analyzer] Analyzer --> Planner[Planner] Planner --> Optimizer[Optimizer] Optimizer --> Plan[Execution Plan] Plan --> Executor[Executor] Executor --> Result[Results]

Full SQL support with recursive descent parser, cost-based optimizer, and volcano-style execution.

Transaction & Concurrency

stateDiagram-v2 [*] --> GROWING: BEGIN GROWING --> SHRINKING: Lock Acquired SHRINKING --> COMMITTED: COMMIT SHRINKING --> ABORTED: ROLLBACK COMMITTED --> [*] ABORTED --> [*]

MVCC with 2PL locking, multiple isolation levels, and automatic deadlock detection.

Vector Search Engine

flowchart TD Query[Vector Query] --> Engine[Vector Engine] Engine --> Algo{Algorithm} Algo --> Flat[Flat/Brute Force] Algo --> HNSW[HNSW Graph] Algo --> IVF[IVF Index] Flat --> Results[Top-K Results] HNSW --> Results IVF --> Results

Multiple algorithms and distance metrics for efficient similarity search in high-dimensional spaces.

Quick Start

Get LatticeDB up and running in minutes

Prerequisites

  • C++17 toolchain (clang++/g++)
  • CMake β‰₯ 3.15
  • Linux/macOS/WSL2

Build Instructions

# Clone repository
git clone https://github.com/hoangsonww/LatticeDB-DBMS.git
cd LatticeDB-DBMS

# Build
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)

# Launch CLI
./latticedb

Using Docker

# Build Docker image
docker build -t latticedb .

# Run container
docker run -it --rm -v $(pwd)/data:/data latticedb

# Or use docker-compose
docker-compose up -d

Start the Web GUI

# Start the database server
./build/latticedb_server

# In a new terminal, start the GUI
cd gui
npm install
npm run dev

# Open http://localhost:5173

The GUI includes SQL editor, schema browser, query history, and dark/light modes.

Example Queries

-- Create table
CREATE TABLE users (
  id INTEGER PRIMARY KEY,
  name VARCHAR(100),
  email VARCHAR(255) UNIQUE
);

-- Insert data
INSERT INTO users VALUES (1, 'Alice', 'alice@example.com');

-- Join query
SELECT u.name, COUNT(o.id) as order_count
FROM users u
INNER JOIN orders o ON u.id = o.user_id
GROUP BY u.id, u.name;

-- Time travel query
SELECT * FROM orders
FOR SYSTEM_TIME AS OF TX 5;

-- Vector search
SELECT * FROM embeddings
WHERE distance(vector, [0.1, 0.2, ...]) < 0.5
ORDER BY distance(vector, [0.1, 0.2, ...])
LIMIT 10;

Production Deployment

Deploy to major cloud providers with built-in monitoring and observability

☁️

AWS

ECS Fargate with auto-scaling, EFS storage, and CloudWatch monitoring

cd aws && ./deploy.sh
  • Application Load Balancer
  • Auto-scaling groups
  • EFS persistent storage
  • CloudWatch logs & metrics
🌐

Azure

Container Apps with serverless scaling and Azure Files integration

cd azure && ./deploy.sh
  • Serverless containers
  • Automatic HTTPS
  • Azure Files storage
  • Application Insights
πŸš€

Google Cloud

Cloud Run with global load balancing and Cloud SQL

cd gcp && ./deploy.sh
  • Fully managed serverless
  • Global load balancer
  • Cloud Storage integration
  • Cloud Monitoring
πŸ—οΈ

HashiCorp Stack

Nomad orchestration with Consul service mesh and Vault secrets

cd hashicorp && ./deploy.sh
  • Service mesh (Consul)
  • Secret management (Vault)
  • Orchestration (Nomad)
  • On-premises ready

Built-in Monitoring & Observability

πŸ“Š

Prometheus Metrics

Request rates, response times, database performance

πŸ“ˆ

Grafana Dashboards

Real-time visualization and custom dashboards

🚨

Intelligent Alerting

PagerDuty, Slack, and email notifications

πŸ”

Distributed Tracing

Jaeger and OpenTelemetry integration

Documentation

Comprehensive guides and references

Performance Benchmarks

Competitive performance on OLTP workloads

Operation LatticeDB PostgreSQL MySQL
Q1 (Scan+Aggregate) 1.2s 1.5s 2.1s
Q3 (Join) 2.1s 2.3s 3.2s
Q5 (5-way Join) 3.2s 3.5s 4.8s
Insert 1M rows 8.5s 9.2s 11.3s
Vector Search (1M, 768D) <100ms ~150ms N/A

Test Environment: AWS c5.4xlarge (16 vCPU, 32GB RAM), TPC-H SF-10 dataset

Note: Performance may vary based on workload, hardware, and configuration

Join the Community

Contribute, learn, and grow with LatticeDB

πŸ’»

Contribute

Help improve LatticeDB by contributing code, documentation, or bug reports

View on GitHub β†’
πŸ“š

Learn

Explore tutorials, examples, and best practices

Read Documentation β†’
🀝

Support

Get help from the community and maintainers

Open an Issue β†’

Open Source

LatticeDB is released under the MIT License. Free to use in commercial and personal projects.

C++17 CMake React TypeScript Docker Terraform