pgbent

pgbent provides PostgreSQL specific benchmarking tools to compare tuning settings, releases, CPUs, or disks. pgbent finds database platform regressions and documents the fixes.

pgbent’s development runs a bare metal hardware Performance Farm lab for regression testing of new releases, as parallel work to the PostgreSQL Community BuildFarm. Public hardware details for the farm are on Geekbench (historical GB6; GB7 soon).

Tuning research

pgbent’s workloads respond predictably to classic OLTP tuning knobs and show why a setting matters.

OSM checkpoint write rate vs interval

Stretch checkpoints and average write volume collapses—a 90% IOPS reduction, here 34 GB/h to 3.5 GB/h—while load throughput rises. That GB/h figure is easy to watch in metrics; this chart shows why it is worth the panel. Details: checkpoint_timeout, max_wal_size, OSM Checkpoint.

pgbent results validate and extend the standard PostgreSQL tuning guide. The Tuning Model section documents studies of parameters that respond predictably to pgbent workloads:

Platform guides cover the layer under those GUCs:

Reference tuning configurations for OSM workloads live in the conf/ directory.

Hardware and release comparisons

Leaderboards — OSM planet load and pgbench SELECT rankings. Initial PostgreSQL 19rc1 report: 19 took the top spots with clear improvement over 18 (rc1 2026-10-15, catalog 20261006).

OSM score history by x86 CPU across PostgreSQL majors

The pgbent OSM Score grades how well PostgreSQL releases run on popular CPUs. The long-term history shows six years of tracked progress even as the underlying Planet extract has kept growing—a counterweight that slows the exponential hardware and software speedups so release-to-release and chip-to-chip gains stay readable. The same traces have also caught packaging and integration issues across PostgreSQL 16–18. Agent docs support reproducibility, and starting with PG19 the bulk of the data has been collected by agents.

Workloads

Databases have a broad set of use cases—read-heavy web, OLTP stores, time series analysis, analytics—and each has enough dimensions that workloads must be precisely modeled to match. pgbent provides free, calibrated, auditable workloads that target known strong and weak spots of modern storage, and that respond predictably to database tuning.

pgbent includes a mix of fixed-size and automatically scaling workloads. Traces are collected over time as new software and hardware are introduced.

Workload What it exercises
pgbench SELECT SELECT, nothing (;), and constant (SELECT 1) across client × size grids; sockets vs TCP, simple vs prepared, point vs random
OpenStreetMap import Real-world bulk load via osm2pgsql—COPY, index builds, checkpoint pressure
Complete Block Check (CBC) Short synthetic storage stress test (CTAS, VACUUM, CLUSTER, index scans)

The OSM loader workload has produced the most interesting recent results, published as blog posts, talks, and social media threads. CBC runs anywhere—from a psql session to a browser based Postgres.

Technical Highlights

pgbent runs repeatable workloads, collects system and database metrics at one-second resolution, and stores everything in a results database for regression testing, tuning studies, and long-term performance history.

  • Orchestrated test runs — Automate pgbench client × database-size grids and arbitrary custom workload scripts.
  • Deep metrics collection — One-second resolution sampling into a PostgreSQL results database, without monitor averaging that hides peak GB/s behavior.
  • Human-readable internals — Metrics grade how effectively each test stresses CPU and storage, useful for tuning training and regression diagnosis.
  • Configuration capture — Server hardware, OS details, and PostgreSQL settings recorded with every run.
  • SQL and visual analysis — Reports in the reports/ directory; the leaderboards page is the public ranking; PostgreSQL 19 and PostgreSQL 18 keep the study tables.
  • Easy to extend and audit — Workloads are plain scripts; the metrics system is transparent shell and SQL.

How it works

While a workload runs, pgbent records system activity and a package of PostgreSQL internals—pg_stat_statements, pg_buffercache, and any custom SQL you attach. Metrics land in a separate results database, where summary SQL gives immediate feedback and Python/Pandas scripts draw workload summaries and per-metric time series.

When pgbent runs on the database server itself, it captures hardware and OS configuration and uses that to help size workloads. The included example metric query records client counts; you can change or extend it to watch anything readable via SQL.

Shell scripts (benchwarmer, runset) orchestrate each run. Scale and client combinations that share a common configuration—one postgresql.conf, one software build, one hardware platform—are grouped into a test set for comparison. See How pgbent works for more on metrics collection and test-set organization.

Getting started

  1. Clone pgbent from GitHub.
  2. Set up the test and results databases.
  3. Run tests with ./runset or ./benchwarmer.
  4. Review results with SQL reports or ./webreport.

See also: Reports, Version compatibility, and Troubleshooting.


This site uses Just the Docs, a documentation theme for Jekyll.