test_many_tables

text/plain

Filename: test_many_tables
Type: text/plain
Part: 1
Message: Re: Further pg_upgrade analysis for many tables
:

. traprm

export QUIET=$((QUIET + 1))

> /rtmp/out

export PGOPTIONS="-c synchronous_commit=off"

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

		echo "table creation" >> /rtmp/out
		newdb test
		for JOT in $(jot "$CYCLES"); do echo "CREATE TABLE test$JOT (x SERIAL);"; done| 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

		echo "pg_dump restore" >> /rtmp/out
		newdb test
		/usr/bin/time --output=/rtmp/out --append --format '%e' sql test < $TMP/1

		echo "combined dump/restore" >> /rtmp/out
		newdb test2
		/usr/bin/time --output=/rtmp/out --append --format '%e' sh -c "aspg pg_dump --schema-only --binary-upgrade test |
			grep -v 'binary_upgrade\.' | sql test2" > $TMP/1

		pgstop
	done

	for BRANCH in master parallel
	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| sql test
		pgstop /u/pgsql.old/data
		sleep 2
		/usr/bin/time --output=/rtmp/out --append --format '%e' tools/upgrade
		sleep 2
	done
done

bell