forked from gregs1104/pgbench-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunset
executable file
·63 lines (55 loc) · 1.74 KB
/
runset
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
. ./config
# Confirm we have a useful pgbench to run
if [ ! -f $PGBENCHBIN ]; then
echo ERROR: cannot find pgbench binary $PGBENCHBIN , aborting
exit
fi
TESTPSQL="psql -h $TESTHOST -U $TESTUSER -p $TESTPORT -d $TESTDB"
# See if this database has all the standard pgbench tables in it
PGCOUNT=`$TESTPSQL -A -t -c "SELECT count(*) FROM pg_stat_user_tables WHERE relname IN ('pgbench_history','pgbench_tellers','pgbench_accounts','pgbench_branches')"`
if [ "$PGCOUNT" -eq 4 ] ; then
TABLEPREFIX="pgbench_"
PGBENCH_TABLES=1
else
TABLEPREFIX=""
PGCOUNT=`$TESTPSQL -A -t -c "SELECT count(*) FROM pg_stat_user_tables WHERE relname IN ('history','tellers','accounts','branches')"`
if [ "$PGCOUNT" -eq 4 ] ; then
PGBENCH_TABLES=1
else
PGBENCH_TABLES=0
fi
fi
for SCALE in $SCALES; do
#
# Have a consistent, clean set of pgbench tables to start
# each test run with
#
if [ "$SKIPINIT" -ne "1" ]; then
if [ "$PGBENCH_TABLES" -eq "1" ] ; then
echo Removing old pgbench tables
$TESTPSQL -c "drop table ${TABLEPREFIX}accounts; drop table ${TABLEPREFIX}branches; drop table ${TABLEPREFIX}tellers; drop table ${TABLEPREFIX}history;"
fi
$TESTPSQL -c "vacuum"
echo Creating new pgbench tables
$PGBENCHBIN -i -s $SCALE -h $TESTHOST -U $TESTUSER -p $TESTPORT $TESTDB
fi
#
# Run the main test
#
for (( t=1; t<=$SETTIMES; t++ )); do
for c in $SETCLIENTS; do
if [ -z "$SETRATES" ] ; then
echo Run set \#$t of $SETTIMES with $c clients scale=$SCALE
./benchwarmer $c
else
for r in $SETRATES; do
echo Run set \#$t of $SETTIMES with $c clients scale=$SCALE rate=$r
./benchwarmer $c $r
done
fi
echo
done
done
done
./webreport