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). By default, pgbench tests a scenario that is loosely based on TPC-B, involving five SELECT, UPDATE, and INSERT commands per transaction. However, it is easy to test other cases by writing your own transaction script files.
By default, pgbench will create the tables:
- pgbench_history
- pgbench_tellers
- pgbench_accounts
- pgbench_branches
with the number of rows shown as follows:
$ /pgbench -U postgres -i testdb NOTICE: table "pgbench_history" does not exist, skipping NOTICE: table "pgbench_tellers" ...