Simple PostgreSQL benchmark powered by Diesel ORM
- Rust 59.6%
- Shell 30.8%
- PLpgSQL 5.5%
- Dockerfile 4.1%
| assets | ||
| configs | ||
| migrations | ||
| src | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| diesel.toml | ||
| Dockerfile | ||
| README.md | ||
| run-all-benchmarks.sh | ||
Basic PostgreSQL Tests with Diesel ORM
This is simple set of tests for me to better understand how PostgreSQL performs under light load, with different operations and configurations. I decided to use Diesel ORM for the logic, because I'm familiar with it, and it presumably adds little overhead.
Quick Start
# Baseline PostgreSQL
bash configs/baseline/run-benchmark.sh
# Optimized PostgreSQL
bash configs/optimized/run-benchmark.sh
# Aggressive PostgreSQL (⚠️ NO DATA SAFETY)
bash configs/aggressive/run-benchmark.sh
# Load Balanced PostgreSQL (HAProxy + 2 Read Replicas)
bash configs/load-balanced/run-benchmark.sh
Results
Specs:
- AMD Ryzen 5 7640U
- 64GB RAM
- 2TB NVMe
Batch Insert Performance
Individual Operations Performance
What's Tested
- Bulk Inserts: 1M records × 10 batches = 10M total records
- Single Writes: Individual insert operations
- Count Queries:
COUNT(*)performance as table grows - Text Exact: Exact string matching on varchar fields
- Text LIKE: Pattern matching on varchar fields
- JSON Filtering: Queries on JSONB fields
Configurations
- Baseline: Standard PostgreSQL with default settings
- Optimized: Tuned single instance (512MB shared_buffers, optimized WAL)
- Aggressive: Extreme performance, no safety (fsync=off, autovacuum=off)
- Load-Balanced: HAProxy + Primary + 2 Read Replicas for parallel reads
Consistent colors across charts: 🔴 Write, 🟢 Count, 🔵 Text Exact, 🟠 Text LIKE, 🟣 JSONB Filter
Note: AI was involved generating parts of this repository, including bash scripts and config README's.







