#!/bin/bash NUM_SESSIONS=100 NUM_TABLES=300 RUNTIME=30 # Create utility function for creating multiple tables and # be able to lock them. psql < bench_script_$i.sql BEGIN; SELECT lock_tables($NUM_TABLES); PREPARE TRANSACTION 't_$i'; COMMIT PREPARED 't_$i'; EOF done # And do the runs with their results in dedicated log files for i in `seq 1 $NUM_SESSIONS`; do pgbench -T $RUNTIME -n -f bench_script_$i.sql > bench_log_$i.txt & done