#!/bin/bash dbname=postgres psql -c "create table if not exists tmp as select random(1,1e9) c1, random(1,1e9) c2,random(1,1e9) c3,random(1,1e9) c4,random(1,1e9) c5,random(1,1e9) c6,random(1,1e9) c7,random(1,1e9) c8,random(1,1e9) c9,random(1,1e9) c10 from generate_series(1,1000000);" $dbname for i in {1..20} do sleep 10 echo "copy tmp to '/dev/null'" > bench.sql pgbench -n -f bench.sql -T 10 $dbname | grep latency done;