A comprehensive migration of the PostgreSQL database management system from C to Rust, leveraging Rust's memory safety guarantees, performance characteristics, and modern language features while maintaining 100% compatibility with existing PostgreSQL functionality, protocols, and ecosystem.
- Memory Safety: Eliminate buffer overflows, use-after-free errors, and memory leaks
- Performance: Maintain or improve upon PostgreSQL's performance characteristics
- Compatibility: Ensure seamless migration with zero breaking changes
- Ecosystem Preservation: Maintain full compatibility with existing PostgreSQL tools and extensions
The project is organized into focused crates with clear boundaries:
postgres-core/ # Main database engine coordination
├─ postgres-storage/ # Storage manager, buffer pool, page management
├─ postgres-wal/ # Write-ahead logging system
├─ postgres-query/ # Parser, planner, executor
├─ postgres-network/ # Protocol handling, connection management
├─ postgres-txn/ # Transaction management and MVCC
├─ postgres-extensions/ # Extension system and C compatibility
├─ postgres-utils/ # Shared utilities and data structures
└─ postgres-ffi/ # C compatibility layer during migration
Current codebase metrics (as of September 2025):
===============================================================================
Language Files Lines Code Comments Blanks
===============================================================================
Rust 167 73,338 58,478 4,224 10,636
Markdown 74 14,628 0 11,240 3,388
TOML 14 777 605 59 113
Python 5 233 164 24 45
Shell 2 231 182 17 32
JSON 1 38 38 0 0
Makefile 1 139 86 15 38
===============================================================================
Total 264 89,384 59,553 15,579 14,252
===============================================================================
Key Metrics:
- 58,478 lines of Rust code across 167 files
- 4,224 lines of comments providing comprehensive documentation
- 11,240 lines of Markdown documentation ensuring clear project guidance
- 264 total files in a well-organized workspace structure
This represents a substantial foundation for the PostgreSQL migration, with robust documentation, comprehensive testing infrastructure, and modular architecture supporting the long-term migration goals.
- Rust 1.70 or later
- Cargo (comes with Rust)
# Clone the repository
git clone https://github.com/postgres/postgres-rust-migration.git
cd postgres-rust-migration
# Build the entire workspace
cargo build --workspace
# Run tests
cargo test --workspace
# Run benchmarks
cargo bench --workspace# Format code
cargo fmt --all
# Run lints
cargo clippy --workspace --all-targets --all-features
# Generate documentation
cargo doc --workspace --no-deps --open- Core data structures and utilities
- FFI compatibility layer
- Storage engine (buffer pool, page management)
- WAL system implementation
- Query parser and planner migration
- Executor engine implementation
- Transaction manager with MVCC
- Process/connection management
- Extension system optimization
- Advanced concurrency models
- Performance optimizations
- Extension migration tools
- Community adoption programs
- Long-term maintenance plan
The project includes comprehensive testing:
# Unit tests
cargo test --workspace
# Integration tests
cargo test --workspace --test integration_tests
# Memory safety tests (requires nightly)
cargo +nightly miri test --workspace
# Performance benchmarks
cargo bench --workspaceWe welcome contributions! Please see CONTRIBUTING.md for guidelines.
This project is licensed under the PostgreSQL License - see the LICENSE file for details.
Note: This is an ambitious, long-term project spanning 8-12 years. The migration is designed to be incremental and maintains compatibility throughout the process.