deform_test2.sh.txt
text/plain
#!/bin/bash
dbname=postgres
secs=15
rows=10000
extra_cols_start=16
extra_cols_end=16
psql -c "alter system set max_parallel_workers_per_gather = 0;" $dbname > /dev/null
psql -c "alter system set jit = 0;" $dbname > /dev/null
psql -c "select pg_reload_conf();" $dbname > /dev/null
psql -c "create extension if not exists pg_prewarm;" $dbname > /dev/null
psql -c "drop table if exists t1,t2,t3;" $dbname > /dev/null
psql -c "create table t1 (c1 bigint not null, c2 bigint not null, c3 bigint not null, c4 bigint not null, c5 bigint not null, c6 bigint not null, c7 bigint not null, c8 bigint not null, c9 bigint not null, c10 bigint not null, c11 bigint not null, c12 bigint not null, c13 bigint not null, c14 bigint not null, c15 bigint not null, c16 bigint not null);" $dbname > /dev/null
psql -c "create table t2 (c1 bigint, c2 bigint not null, c3 bigint not null, c4 bigint not null, c5 bigint not null, c6 bigint not null, c7 bigint not null, c8 bigint not null, c9 bigint not null, c10 bigint not null, c11 bigint not null, c12 bigint not null, c13 bigint not null, c14 bigint not null, c15 bigint not null, c16 bigint not null);" $dbname > /dev/null
psql -c "create table t3 (c1 text not null, c2 bigint not null, c3 bigint not null, c4 bigint not null, c5 bigint not null, c6 bigint not null, c7 bigint not null, c8 bigint not null, c9 bigint not null, c10 bigint not null, c11 bigint not null, c12 bigint not null, c13 bigint not null, c14 bigint not null, c15 bigint not null, c16 bigint not null);" $dbname > /dev/null
psql -c "insert into t1 select 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 from generate_Series(1,$rows);" $dbname > /dev/null
psql -c "insert into t2 select null,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 from generate_Series(1,$rows);" $dbname > /dev/null
psql -c "insert into t3 select '1',1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 from generate_Series(1,$rows);" $dbname > /dev/null
for tbl in "t1" "t2" "t3"
do
echo "Table $tbl"
psql -c "vacuum freeze analyze $tbl;" $dbname > /dev/null
psql -c "select pg_prewarm('$tbl');" $dbname > /dev/null
echo "select count(c16) from $tbl;" > bench.sql
for i in {1..3}
do
sleep 10
pgbench -n -f bench.sql -M prepared -T $secs $dbname | grep tps
done
done