duplicatetest.sh
application/x-sh
#!/bin/bash
PATH=~/pgsql.master/bin:$PATH
export PATH
psql postgres <<EOF
create table if not exists duplicatetest_summary (testname text, finalsize bigint, idx_blks_read bigint, idx_blks_hit bigint);
drop table if exists duplicatetest;
create table duplicatetest (p point);
create index d_idx on duplicatetest using gist (p);
insert into duplicatetest select point(1,1) from generate_series(1, 1000000);
insert into duplicatetest_summary (testname, finalsize, idx_blks_read, idx_blks_hit)
select '$1', pg_relation_size('d_idx'), idx_blks_read, idx_blks_hit from pg_statio_user_indexes where indexrelname = 'd_idx';
EOF