string_agg_test.sh.txt

text/plain

Filename: string_agg_test.sh.txt
Type: text/plain
Part: 0
Message: Making aggregate deserialization (and WAL receive) functions slightly faster
#!/bin/bash

psql -c "drop table if exists t;" postgres
psql -c "create table t (a text not null);" postgres
psql -c "insert into t select x::text from generate_series(1,1000000)x;" postgres
psql -c "vacuum freeze t;" postgres
psql -c "select pg_prewarm('t');" postgres
for q in "select length(string_agg(a,',')) from t;"
do
	for i in {0..32}
	do
			echo Testing with $i parallel workers: $q
			psql -c "alter table t set (parallel_workers = $i);" postgres
			echo $q > bench.sql
			pgbench -f bench.sql -n -T 10 postgres | grep latency
	done
done