-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpg_bench
33 lines (26 loc) · 1.1 KB
/
pg_bench
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# create the test database with the name "test"
psql -d postgres -U postgres -c "CREATE DATABASE test"
# -i = initialize
# -s = scale default database value(16MB) * s
# time = measure the time for executing the command
pgbench -i -s 50 test -U postgres
# from pgbench created tables
#tablename number of rows
--------------------------------------
pgbench_branches s
pgbench_tellers s*10
pgbench_accounts s*100.000
pgbench_history 0
# c = number of client connections to simulate
# j = number of worker processes for pgbench
# t = tps per client session => c*t
pgbench -c 10 -j 2 -t 10000 test -U postgres
# read-only test
# create the test database with the name "test_read"
psql -d postgres -U postgres -c "CREATE DATABASE test_read"
# -S = use built in select only script
pgbench -h <Standby LoadBalancer IP> -p 5432 -d -c 50 -j 10 -t 10000 -S test_read -U postgres
# kill database with heavy resource usage
pgbench -c 90 -j 10 -t 100000 test -U postgres
# get size of database
SELECT pg_size_pretty( pg_database_size('databasename') );