drop table test;

CREATE TABLE test (box box);
alter table test set (autovacuum_enabled=off);

insert into  test (select box(point(x, x),point(x, x)) 
	from generate_series(1,5000000) as x);

vacuum test;	

CREATE INDEX test_idx ON test USING gist (box);

SET enable_seqscan TO false;
SET enable_bitmapscan TO false;
SET enable_indexscan TO true;
SET enable_indexonlyscan TO true;

select count(box) from test where box && box(point(0,0), point(1000000,1000000));

delete from test where box && box(point(0,0), point(1000000,1000000));

-- This query invokes gistkillitems()
select count(box) from test where box && box(point(0,0), point(1000000,1000000));

-- These queries should work faster with microvacuum
select count(box) from test where box && box(point(0,0), point(1000000,1000000));
select count(box) from test where box && box(point(0,0), point(1000000,1000000));
select count(box) from test where box && box(point(0,0), point(1000000,1000000));
