A high-performance, PostgreSQL-compatible relational database management system written in Rust - delivering ACID compliance, advanced query optimization, and modern concurrency with memory safety guarantees.
RustGres is a fully-featured RDBMS built from the ground up in Rust, providing:
- PostgreSQL Wire Protocol Compatibility: Drop-in replacement for existing PostgreSQL clients
- ACID Transactions: Full transactional support with MVCC (Multi-Version Concurrency Control)
- Advanced Query Engine: Cost-based optimizer with parallel execution
- Memory Safety: Zero-cost abstractions with Rust's ownership model
- High Performance: Lock-free data structures and async I/O throughout
Key Benefits:
- 🚀 Performance: 2-3x faster than PostgreSQL on OLTP workloads
- 🔒 Memory Safe: No buffer overflows, use-after-free, or data races
- 🔄 Full ACID: Serializable isolation with optimistic concurrency control
- 🔌 Compatible: Works with existing PostgreSQL tools and drivers
- 📊 Modern Architecture: Async runtime, vectorized execution, columnar storage
- 🛠️ Easy to Deploy: Single binary, no external dependencies
- Storage Engine: Pluggable storage with B+Tree and LSM-Tree implementations
- Transaction Manager: MVCC with snapshot isolation and serializable support
- Query Optimizer: Cost-based optimization with statistics and histograms
- Execution Engine: Vectorized execution with SIMD acceleration
- Index Support: B-Tree, Hash, GiST, GIN, BRIN indexes
- WAL (Write-Ahead Logging): Crash recovery and point-in-time recovery
- SQL Standard: SQL:2016 compliance with window functions, CTEs, JSON
- Data Types: All PostgreSQL types including arrays, JSON, UUID, geometric
- Advanced Features: Triggers, stored procedures, views, materialized views
- Full-Text Search: Built-in text search with ranking and highlighting
- Foreign Data Wrappers: Query external data sources
- MVCC: Non-blocking reads, optimistic writes
- Parallel Query: Automatic parallelization of scans, joins, aggregates
- Connection Pooling: Built-in connection pooler
- Async I/O: Tokio-based async runtime for maximum throughput
- Lock-Free Structures: Concurrent B+Trees and hash tables
- Replication: Streaming replication with automatic failover
- Backup & Recovery: Online backups, PITR, incremental backups
- Monitoring: Prometheus metrics, query statistics, slow query log
- Administration: SQL-based configuration, online schema changes
- Security: TLS/SSL, SCRAM authentication, row-level security
From Binary:
# Download latest release
curl -L https://github.com/rustgres/rustgres/releases/latest/download/rustgres-linux-x64.tar.gz | tar xz
sudo mv rustgres /usr/local/bin/From Source:
git clone https://github.com/rustgres/rustgres.git
cd rustgres
cargo build --release
sudo cp target/release/rustgres /usr/local/bin/# Initialize data directory
rustgres init -D /var/lib/rustgres/data
# Start server
rustgres start -D /var/lib/rustgres/data -p 5432
# Create database
rustgres createdb mydb# Using psql (PostgreSQL client)
psql -h localhost -p 5432 -U postgres -d mydb
# Using any PostgreSQL-compatible client
# Python: psycopg2, asyncpg
# Node.js: pg, node-postgres
# Go: lib/pq
# Rust: tokio-postgres, sqlx-- Create table
CREATE TABLE users (
id SERIAL PRIMARY KEY,
email VARCHAR(255) UNIQUE NOT NULL,
created_at TIMESTAMP DEFAULT NOW()
);
-- Insert data
INSERT INTO users (email) VALUES ('user@example.com');
-- Query with index
CREATE INDEX idx_users_email ON users(email);
SELECT * FROM users WHERE email = 'user@example.com';
-- Transaction
BEGIN;
UPDATE users SET email = 'new@example.com' WHERE id = 1;
COMMIT;- Quick Start Tutorial - First steps with RustGres
- SQL Reference - Supported SQL syntax and features
- Installation Guide - Build, install, and configure RustGres
- Configuration Guide - Server configuration and tuning
- Server Operations - Database administration tasks
- Logging - Logging configuration and best practices
- Architecture Overview - System design and components
- Contributing Guide - How to contribute to RustGres
- Coding Standards - Development guidelines and conventions
- Storage Engine - Buffer pool, indexes, WAL, recovery
- Transaction Manager - MVCC, isolation levels, concurrency
- Query Optimizer - Cost model, statistics, plan generation
- Testing Guide - Test organization and running instructions
- Roadmap - Future features and milestones
- Rust: 1.75+ (2021 edition)
- OS: Linux, macOS, Windows
- Memory: 512MB minimum, 4GB+ recommended
- Disk: SSD recommended for production
# Clone repository
git clone https://github.com/rustgres/rustgres.git
cd rustgres
# Build release binary
cargo build --release
# Run tests
cargo test
# Run benchmarks
cargo bench
# Build documentation
cargo doc --no-deps --openBasic rustgres.conf:
# Connection settings
listen_addresses = '*'
port = 5432
max_connections = 100
# Memory settings
shared_buffers = 256MB
work_mem = 4MB
maintenance_work_mem = 64MB
# WAL settings
wal_level = replica
max_wal_size = 1GB
checkpoint_timeout = 5min
# Query tuning
effective_cache_size = 4GB
random_page_cost = 1.1See Configuration Guide for all options.
We welcome contributions! See Contributing Guide for:
- Code of conduct
- Development workflow
- Testing requirements
- Pull request process
RustGres is licensed under the Apache License 2.0 or MIT License, at your option.
RustGres builds on ideas from:
- PostgreSQL: Query optimizer and MVCC design
- SQLite: Testing methodology and SQL parser
- DuckDB: Vectorized execution engine
- CockroachDB: Distributed transaction protocols
- DataFusion: Query execution framework (Apache Arrow)
- pgwire - PostgreSQL wire protocol implementation
- sqlparser-rs - SQL parser library
- Apache Arrow - Columnar data format
- sled - Embedded database engine