Measuring postgresql performance using pgbench

925 views Asked by At

I just have a general question to test PostgreSQL performance using pgbench benchmark.

Here are the order of tests I am running:

./pgbench -i -s 2000 pgbench
./pgbench -c 3 -j 3 -T 800 -l --aggregate-interval 1 pgbench
./pgbench -c 3 -j 3 -T 800 -l --aggregate-interval 1 pgbench
./pgbench -c 3 -j 3 -T 800 -l --aggregate-interval 1 pgbench
  • Due to the randomness, I am running the read-write test 3 times.

Is this the correct way to measure read-write performance? or do I have to initialize the database before each test run so that it looks like this:

./pgbench -i -s 2000 pgbench 
./pgbench -c 3 -j 3 -T 800 -l --aggregate-interval 1 pgbench 
./pgbench -i -s 2000 pgbench 
./pgbench -c 3 -j 3 -T 800 -l --aggregate-interval 1 pgbench 
./pgbench -i -s 2000 pgbench 
./pgbench -c 3 -j 3 -T 800 -l --aggregate-interval 1 pgbench
1

There are 1 answers

0
Robins Tharakan On

What you're looking for a repeatable numbers, i.e. When a configuration is run again, it should give (nearly) the same answer.

Per documentation, for this, you can simply increase the -T to a few minutes / hours, which ensures that a lot of the noise is averaged out.

To answer your query, no, a repeat of dropdb / createdb / pgbench -i should not be necessary.