psql -c 'drop table if exists t'
psql -c 'create table t (i bigint);'
psql -c "CREATE INDEX ON t(right(i::text,1)) WHERE i::text LIKE '%1';"

while true
do
	psql -qXc "VACUUM FULL pg_toast.pg_toast_2619;"
	psql -qXc "VACUUM FULL pg_statistic;"
done &

while true
do
	psql -Xc "INSERT INTO t SELECT i FROM generate_series(1,999999) i"
	for a in `seq 999`
	do
		psql -Xc "ALTER TABLE t ALTER i TYPE int USING i::int"
		psql -Xc "ALTER TABLE t ALTER i TYPE bigint"
	done
	psql -Xc "TRUNCATE t"
done &

while true
do
	psql -Xc '\d t'
	sleep 1
done




