Simple PostgreSQL benchmark powered by Diesel ORM
  • Rust 59.6%
  • Shell 30.8%
  • PLpgSQL 5.5%
  • Dockerfile 4.1%
Find a file
2025-08-04 13:09:16 +01:00
assets initial commit 2025-08-04 13:09:16 +01:00
configs initial commit 2025-08-04 13:09:16 +01:00
migrations initial commit 2025-08-04 13:09:16 +01:00
src initial commit 2025-08-04 13:09:16 +01:00
.gitignore initial commit 2025-08-04 13:09:16 +01:00
Cargo.lock initial commit 2025-08-04 13:09:16 +01:00
Cargo.toml initial commit 2025-08-04 13:09:16 +01:00
diesel.toml initial commit 2025-08-04 13:09:16 +01:00
Dockerfile initial commit 2025-08-04 13:09:16 +01:00
README.md initial commit 2025-08-04 13:09:16 +01:00
run-all-benchmarks.sh initial commit 2025-08-04 13:09:16 +01:00

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

Baseline Batch Performance Optimized Batch Performance Aggressive Batch Performance Load Balanced Batch Performance

Individual Operations Performance

Baseline Operations Optimized Operations Aggressive Operations Load Balanced Operations

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

  1. Baseline: Standard PostgreSQL with default settings
  2. Optimized: Tuned single instance (512MB shared_buffers, optimized WAL)
  3. Aggressive: Extreme performance, no safety (fsync=off, autovacuum=off)
  4. 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.