test.sh
text/x-sh
Filename: test.sh
Type: text/x-sh
Part: 0
NDATA=32
NTRY=2
NCLIENTS=4
TIME=120
for childs in 64 128 256
do
pg_ctl stop -mi
rm -r $PGDATA
initdb -E UTF8 --no-locale
cat <<EOF >> $PGDATA/postgresql.conf
shared_buffers = 512MB
max_wal_size = 20GB
checkpoint_timeout = 1h
EOF
pg_ctl start
psql -c "create unlogged table parent (c int) partition by list(c)"
cat <<EOF | psql > /dev/null
select 'create unlogged table p' || i || ' partition of parent for values in (' || i || ')' from generate_series(0,$childs) i; \gexec
EOF
echo "insert into parent select ((random() * 1000)::int % $childs) from generate_series(1,$NDATA)" > data.sql
pgbench -i -n postgres
avg=0
total=0
for t in `seq 1 $NTRY`
do
tps=`bin/pgbench -T $TIME -c ${NCLIENTS} -f data.sql -n postgres | grep "excluding" | cut -d " " -f 3`
echo "CHILDS = $childs, TRIS = $t, TPS = $tps"
total=$(echo "$tps + $total" | bc)
done
avg=$(echo "$total / $NTRY" | bc)
echo "nchilds = $childs tps = $avg" >> result_${1}.txt
done
pg_ctl stop