deeejay icon

PgBench - Commands

deeejay | PRO | 04/11/16 08:10:41 PM UTC | 0 ⭐ | 275 👁️ | Never ⏰ | []
Bash |

960 B

|

None

|

0 👍

/

0 👎

PgBench (circa 1990s)
===
createdb bench = create database to test against
pgbench -i bench = initialize pgbench to database (creates "banking" tables)
pgbench bench
 
pgbench -i -s 100 bench
-s = scaling factor (default: 100,000; scaling factor of 100 creates 10,000,000 rows of data) 
 
 
pgbench -T 120 -j 2 -c 20 -S bench
-T = timer (in seconds) - best practice is 1 hr
-j = number of jobs (# of server cores)
-c = client connections (simulates 20 sessions; the more clients, the more loads on the server; # of clients should be multiple of cores)
-S = Read-only (remove to test read and writes to the database)
bench = database name
 
pgbench -T 120 -j 2 -c 20 bench
this tests read/writes
 
Results:
tps = transactions per second; higher is better
Not all benchmarks will use cache; lower tps means the benchmark test might be using cache vs disk
 
 
Run the benchmarks at least 3 times for an hour each to get a good average (Per Tom Lane - PostgreSQL maintainer)

Comments