distance-test.sh
application/x-shellscript
#!/usr/bin/env bash
PATH_OLD=$PATH
set -e
for checksums in on off; do
for device in raid-nvme raid-sata data; do
DATADIR=/mnt/$device/data-distance
export PATH=/home/tomas/builds/master/bin:$PATH_OLD
rm -Rf $DATADIR
# init the table
pg_ctl -D $DATADIR init
pg_ctl -D $DATADIR -l pg.log start
createdb test
psql test < init.sql
pg_ctl -D $DATADIR stop
if [ "$checksums" == "off" ]; then
pg_checksums --disable $DATADIR
fi
for build in master patched patched-vondra patched-munro patched-no-explain patched-vondra-no-explain patched-munro-no-explain; do
export PATH=/home/tomas/builds/$build/bin:$PATH_OLD
for buffers in 512MB 16GB; do
for eic in 16 100; do
for iomethod in worker io_uring; do
for ioworkers in 3 12; do
if [ "$ioworkers" == "12" ] && [ "$iomethod" == "io_uring" ]; then
continue
fi
echo "shared_buffers = $buffers" >> $DATADIR/postgresql.conf
echo "io_method = $iomethod" >> $DATADIR/postgresql.conf
echo "io_workers = $ioworkers" >> $DATADIR/postgresql.conf
echo "effective_io_concurrency = $eic" >> $DATADIR/postgresql.conf
for r in $(seq 1 5); do
sudo ./drop-caches.sh
pg_ctl -D $DATADIR -l pg.log start
numactl --physcpubind=1 psql test < query2.sql > query.log 2>&1
cold=$(grep 'Time' query.log | awk '{print $2}' | head -n 1)
warm=$(grep 'Time' query.log | awk '{print $2}' | tail -n 1)
echo $device $checksums $build $buffers $eic $iomethod $ioworkers $r $cold $warm >> results.csv
echo "========== $device $checksums $build $buffers $eic $iomethod $ioworkers $r $cold $warm ==========" >> explain.log
cat query.log >> explain.log
pg_ctl -D $DATADIR -l pg.log stop
done
done
done
done
done
done
done
done