#!/bin/bash

psql <<EOF
create table measurements (id int, test text, start pg_lsn, stop pg_lsn);
create table aa (a int);
insert into measurements (id, start, test) values (1,
	pg_current_xlog_location(), 'compress = on, insert 10000000');
INSERT INTO aa values (generate_series(1,10000000));
update measurements set stop = pg_current_xlog_location() where id = 1;
EOF
pg_ctl -w stop
echo full_page_writes = on >> $PGDATA/postgresql.conf
pg_ctl -w start
psql <<EOF
insert into measurements (id, start, test) values (2,
	pg_current_xlog_location(), 'compress = off, insert 10000000');
INSERT INTO aa values (generate_series(1,10000000));
update measurements set stop = pg_current_xlog_location() where id = 2;
select test, stop - start from measurements;
EOF
