#!/bin/sh

t=tmm
power=7

echo "\\timing
  drop table if exists $t ;
  create table $t as select i, (random() *  50000000/10 + i)::integer as r from generate_series(1,   50000000 ) as f(i) ;
  analyze $t;
  create index ${t}_minmax_idx on $t using minmax (r);
--  create index on $t (r);
  analyze $t;
" | psql -Xa

for f in `seq 50000000 50000000 500000000`; do
  diff4=$(( $f+50000000 )); 
  echo "\\timing
    insert into $t select i, (random() *  50000000/10 + i)::integer from generate_series($f, $diff4 ) as f(i) ;
  " | psql -Xa
done

