The following are scripts I use for pgbench. The scripts assume:

  1. A database named example
  2. The tools are located in the folder /usr/pgsql-17/bin/
  3. A .pgpass file so we don’t have to worry about credentials
# Create the example database and run pgbench tests
/usr/pgsql-17/bin/pgbench -i -s 50 example

# Run pgbench with different configurations
# Basic test with 10 clients, 2 threads, 20000 transactions
/usr/pgsql-17/bin/pgbench -c 10 -n -j 2 -t 20000 -P 30 example

# Test with 40 clients, 2 threads, 50000 transactions
/usr/pgsql-17/bin/pgbench -c 40 -n -j 2 -t 50000 -P 30 example

# Clean up the pgbench tables
/usr/pgsql-17/bin/pgbench -i -I d

By Rudy