\set n 1000000
--\set m 10
\set q 'explain analyze select distinct a from t where a > :n / :m / 3 and a < 2 * :n / :m /3'
--\set q 'explain analyze select distinct a from t'

reset all;
drop table t cascade;
create table t(a) as select generate_series(1, :n) / :m;
create index idx_t_a on t(a);
analyze t;

-- prewarm
set enable_seqscan to off;
explain analyze select * from t;
reset enable_seqscan;
explain analyze select * from t;

\echo :q
\echo group-size :m
-- benchmark
:q;

set enable_hashagg to off;
:q;

set enable_indexskipscan to off;
:q;
\echo benchmark-done
