:

. traprm

export QUIET=$((QUIET + 1))

> /rtmp/out

for CYCLES in 1 1000 2000 4000 8000 16000 32000 64000
do
	echo "$CYCLES" >> /rtmp/out

#	for DIR in /pgsql/CURRENT
#	do	echo "$DIR" >> /rtmp/out
#		cd "$DIR"
#		pginstall
#		cd -
#
#		# need for +16k
#		pipe sed 's/#max_locks_per_transaction = 64/max_locks_per_transaction = 3000/' /u/pg/data/postgresql.conf
#		pipe sed 's/shared_buffers = 128MB/shared_buffers = 1GB/' /u/pg/data/postgresql.conf
#		pipe sed 's/#work_mem = 1MB/work_mem = 500MB/' /u/pg/data/postgresql.conf
#		pipe sed 's/#maintenance_work_mem = 16MB/maintenance_work_mem = 500MB/' /u/pg/data/postgresql.conf
#		pgrestart
#		sleep 2
#
#		newdb test
#		for JOT in $(jot "$CYCLES"); do echo "CREATE TABLE test$JOT (x SERIAL);"; done| PGOPTIONS="-c synchronous_commit=off" sql test
#		echo "pg_dump creation" >> /rtmp/out
#
#		/usr/bin/time --output=/rtmp/out --append --format '%e' aspg pg_dump --schema-only test > $TMP/1
#		newdb test
#		echo "pg_dump restore" >> /rtmp/out
#		PGOPTIONS="-c synchronous_commit=off" /usr/bin/time --output=/rtmp/out --append --format '%e' sql test < $TMP/1
#
#		echo "with pg_dump --binary-upgrade" >> /rtmp/out
#		newdb test
#		for JOT in $(jot "$CYCLES"); do echo "CREATE TABLE test$JOT (x SERIAL);"; done| PGOPTIONS="-c synchronous_commit=off" sql test
#		echo "pg_dump creation" >> /rtmp/out
#
#		/usr/bin/time --output=/rtmp/out --append --format '%e' aspg pg_dump --schema-only --binary-upgrade test |
#			grep -v 'binary_upgrade\.' > $TMP/1
#		newdb test
#		echo "pg_dump restore" >> /rtmp/out
#		PGOPTIONS="-c synchronous_commit=off" /usr/bin/time --output=/rtmp/out --append --format '%e' sql test < $TMP/1
#
#		pgstop
#	done
	
	for BRANCH in master bsearch
	do	cd /pgtop
		pgsw $BRANCH
		cd -
		tools/setup 9.3 9.3
		sleep 2
	
		# need for +16k
		pipe sed 's/#max_locks_per_transaction = 64/max_locks_per_transaction = 3000/' /u/pgsql.old/data/postgresql.conf
		pipe sed 's/shared_buffers = 128MB/shared_buffers = 1GB/' /u/pgsql.old/data/postgresql.conf
		pipe sed 's/shared_buffers = 128MB/shared_buffers = 1GB/' /u/pgsql/data/postgresql.conf
	
		pgstart /u/pgsql.old/data
		sleep 8
		for JOT in $(jot "$CYCLES"); do echo "CREATE TABLE test$JOT (x SERIAL);"; done| PGOPTIONS="-c synchronous_commit=off" sql test
		pgstop /u/pgsql.old/data
		sleep 2
		/usr/bin/time --output=/rtmp/out --append --format '%e' tools/upgrade
	done
done

bell

