-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpg_bench
More file actions
22 lines (14 loc) · 1.03 KB
/
pg_bench
File metadata and controls
22 lines (14 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
https://blog.codeship.com/tuning-postgresql-with-pgbench/
postgres=# create database example;
CREATE DATABASE
### -i (initialize) option
pgbench -i -s 50 example
The next option is the -j (threads) flag. This flag is used to define the number of worker processes for pgbench. In the above command, I specified the value of
2. This will tell pgbench to start two worker processes during the benchmarking.
The third option used is -t (transactions), which is used to specify the number of transactions to execute.
In the command above, I provided the value of 10,000. However this doesn’t mean that only 10,000 transactions will be executed against our database service.
What it means is that each client session will execute 10,000 transactions.
To summarize, the baseline test run was two pgbench worker processes simulating 10,000 transactions from 10 clients for a total of 100,000 transactions.
With that understanding, let’s take a look at the results of this first test.
pgbench -c 10 -j 2 -t 10000 example
pgbench -c 2 -j 2 -t 100 example