Created
February 24, 2021 14:27
-
-
Save tavin/87d4daef1ee7bbf7ce235036f6e2b45d to your computer and use it in GitHub Desktop.
pgbench.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -ex | |
scale=20 # table size factor; should not be less than $clients | |
clients=10 # number of concurrent sessions | |
jobs=$((`nproc`/2)) # threads i.e. how many cpus to use | |
duration=300 # length of test in seconds | |
progress=10 # progress reporting interval | |
filesystem=postgresql/pgbench | |
PATH="/usr/pgsql-9.5/bin:$PATH" | |
sudo zfs destroy "$filesystem" || true | |
sudo zfs create "$filesystem" | |
export PGPORT=5411 PGDATA=$(zfs get mountpoint "$filesystem" -Ho value) | |
sudo chown -R postgres: "$PGDATA" | |
initdb -A trust -E UTF8 --locale en_US.UTF8 | |
pg_ctl start -w | |
createdb pgbench | |
pgbench -i -s "$scale" pgbench | |
pgbench -c "$clients" -j "$jobs" -T "$duration" -P "$progress" pgbench | |
sudo fuser -vkMm "$PGDATA" | |
sudo zfs destroy "$filesystem" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ssh postgres@wherever < pgbench.sh