الملفات
psql-bench/results.md
2026-02-15 07:21:14 +00:00

3.1 KiB

بسم الله الرحمن الرحيم

PostgreSQL Benchmark Performance Report

Environment

  • Database: demo2
  • Host: j-test-pg.hosted.cumin.dev
  • Test Queries: SELECT 1 and INSERT INTO test_table
  • Runs per test: 1,000

1. Read Performance (SELECT 1)

Metrics

Metric Value (ms)
Minimum 0.75
Maximum 1.84
Average 1.21
Median 1.11

Percentiles

Percentile Value (ms)
p25 0.88
p50 1.11
p75 1.50
p99 1.84

Analysis

Read performance shows excellent consistency. The spread between p25 (0.88ms) and p99 (1.84ms) is less than 1ms, indicating stable query execution with minimal variance. The max time of 1.84ms is only 2.45x the minimum, demonstrating predictable performance under test conditions.


2. Write Performance (INSERT)

Metrics

Metric Value (ms)
Minimum 0.67
Maximum 5.97
Average 1.18
Median 1.08

Percentiles

Percentile Value (ms)
p25 0.89
p50 1.08
p75 1.32
p99 3.16

Analysis

Write performance is efficient for typical operations with median under 1.1ms. The majority of writes (75%) complete within 1.32ms. However, there is notable variance in the tail:

  • The max time (5.97ms) is 8.9x higher than the minimum
  • p99 (3.16ms) is nearly 3x the median
  • The gap between p75 (1.32ms) and p99 (3.16ms) suggests occasional latency spikes

3. Read vs Write Comparison

Metric Read (ms) Write (ms) Difference
Min 0.75 0.67 Write 11% faster
Median 1.11 1.08 Write 3% faster
Max 1.84 5.97 Write 224% slower
p99 1.84 3.16 Write 72% slower

Key Observations

  • Typical performance: Writes are slightly faster than reads for median operations
  • Tail latency: Writes show significantly higher variance in worst-case scenarios
  • Consistency: Reads maintain tight distribution; writes have occasional spikes

4. Recommendations

  1. Monitor write spikes - Investigate the 5.97ms max time (checkpoint activity, WAL flushing, or resource contention)

  2. Establish baseline under load - Re-run tests during peak traffic to understand real-world impact

  3. Test additional patterns - Benchmark UPDATE, DELETE, and batch operations for complete picture

  4. Review configuration - If write tail latency is concerning, examine:

    • Checkpoint intervals
    • WAL settings
    • Disk I/O performance
    • Connection pool behavior

5. Raw Data

Read Results

{'runs': 1000, 'min_time': '0.747496', 'max_time': '1.835447', 'avg_time': '1.205721', 'median_time': '1.114015', 'percentiles': {'p25': '0.880932', 'p50': '1.114015', 'p75': '1.504819', 'p99': '1.835447'}}

Write Reults

{'runs': 1000, 'min_time': '0.672305', 'max_time': '5.96997', 'avg_time': '1.181518', 'median_time': '1.083002', 'percentiles': {'p25': '0.891029', 'p50': '1.083002', 'p75': '1.32006', 'p99': '3.157841'}}