Skip to content

PostgreSQL — Benchmarks

Scope

PostgreSQL performance metrics, pgbench results, scaling characteristics, and comparison baselines.

pgbench Results (Standard Benchmark)

TPC-B Like Workload

Hardware Clients TPS (read-write) TPS (read-only) Latency P99
4 vCPU, 16Gi, SSD 16 2,500-4,000 15,000-25,000 5-10ms
8 vCPU, 32Gi, NVMe 32 8,000-15,000 50,000-80,000 2-5ms
16 vCPU, 64Gi, NVMe 64 20,000-35,000 100,000-150,000 1-3ms
32 vCPU, 128Gi, NVMe 128 40,000-60,000 200,000-300,000 1-2ms

Index Performance

Operation B-tree Hash GIN GiST BRIN
Point lookup ~0.1ms ~0.05ms N/A ~0.5ms ~1ms
Range scan ~1ms N/A ~5ms ~2ms ~0.5ms
Insert overhead Low Low High Medium Very low
Storage per row 8-16 bytes 4-8 bytes Variable Variable ~1 byte

Connection Scaling

Connection Count Without PgBouncer With PgBouncer Notes
50 100% baseline 100% No difference
200 85-90% 98% PgBouncer multiplexes
500 60-70% 95% Memory pressure without pooler
1,000 30-40% 90% Context switching kills perf
5,000 Fails (OOM) 85% Must use connection pooling

WAL Write Performance

Storage Type WAL Write Throughput fsync Latency Notes
HDD 50-100 MB/s 5-20ms Not recommended for production
SATA SSD 200-500 MB/s 0.5-2ms Acceptable for small deployments
NVMe SSD 1-3 GB/s 0.05-0.2ms Recommended for production

Replication Performance

Scenario Replication Lag Throughput Notes
Async, same DC < 10ms Near line-rate Default config
Async, cross-DC 10-100ms Network limited WAN bandwidth matters
Sync, same DC < 1ms 70-80% of standalone Commit must wait for replica
Sync, cross-DC 10-50ms 20-40% of standalone Not recommended for write-heavy

Scaling Limits

Dimension Soft Limit Hard Limit Notes
Database size 10TB (comfortable) 100TB+ Needs partitioning beyond 10TB
Table size 1TB 32TB Partition large tables
Rows per table 1 billion No hard limit Performance degrades with bloat
Columns per table 250 1,600 TOAST for wide rows
Indexes per table 20 No limit Each index adds write overhead
Concurrent connections 200-500 10,000+ (with pooler) Use PgBouncer