pgbench
pgBench is a simple program for running benchmark tests on PostgreSQL. It runs the same sequence of SQL commands over and over, possibly in multiple concurrent database sessions, and then calculates the average transaction rate (transactions per second).
MODE: pgbench
Environment Variables
Required
Name | Default | Description |
---|---|---|
PG_DATABASE | None | Set this value to the database which pgBench should use |
PG_HOSTNAME | None | Set this value to the hostname of the PostgreSQL primary to benchmark |
PG_USERNAME | None | Set this value to specify the username used to run the benchmark |
PG_PASSWORD | None | Set this value to specify the password of the user to run the benchmark. |
Optional
Name | Default | Description |
---|---|---|
MODE | None | Set to pgbench to run as pg_bench job |
PGBENCH_BENCHMARK_OPTS | none | Set this value to specify custom benchmark parameters to pass to pgBench. |
PGBENCH_CLIENTS | 1 | Set this value to the number of clients to use for the benchmark. |
PGBENCH_INIT_OPTS | none | Set this value to specify custom initialization parameters for pgBench. |
PGBENCH_JOBS | 1 | Set this value to the number of worker threads to be used by pgBench. |
PGBENCH_SCALE | 1 | Set this value to multiply the number of rows generated by the scale factor. For example, 100 will create 10,000,000 rows in the pgbench_accounts table |
PGBENCH_TRANSACTIONS | 1 | Set this value to configure the number of transactions each client runs |
PG_PORT | 5432 | Set this value to specify the port of the PostgreSQL host. |
CRUNCHY_DEBUG | FALSE | Set this to true to enable debugging in logs. Note: this mode can reveal secrets in logs. |
For a list of advanced options for configuring the `PGBENCH_BENCHMARK_OPTS` variable, see the official documentation:
https://www.postgresql.org/docs/current/pgbench.html
Custom Configuration
The following configuration files can be mounted to the /pgconf
volume in the crunchy-pgbench
container to customize the runtime:
Name | Description |
---|---|
transactions.sql |
Custom transaction script to use for creating custom pgBench tests. |