\timing on

show work_mem;
show maintenance_work_mem;

select count(*) FROM (select * from lotsofints order by i) t;
select count(*) FROM (select * from lotsofints order by i) t;
select count(*) FROM (select * from lotsofints order by i) t;
select count(*) FROM (select * from lotsofints order by i) t;

select count(*) FROM (select * from lotsoftext order by i) t;
select count(*) FROM (select * from lotsoftext order by i) t;
select count(*) FROM (select * from lotsoftext order by i) t;
select count(*) FROM (select * from lotsoftext order by i) t;

select count(*) FROM (select * from lotsofitext order by i, j, w, z, z2) t;
select count(*) FROM (select * from lotsofitext order by i, j, w, z, z2) t;
select count(*) FROM (select * from lotsofitext order by i, j, w, z, z2) t;
select count(*) FROM (select * from lotsofitext order by i, j, w, z, z2) t;

select count(*) FROM (select * from lotsofitext order by i, j) t;
select count(*) FROM (select * from lotsofitext order by i, j) t;
select count(*) FROM (select * from lotsofitext order by i, j) t;
select count(*) FROM (select * from lotsofitext order by i, j) t;

select count(*) FROM (select * from lotsofitext order by z, z2) t;
select count(*) FROM (select * from lotsofitext order by z, z2) t;
select count(*) FROM (select * from lotsofitext order by z, z2) t;
select count(*) FROM (select * from lotsofitext order by z, z2) t;

select count(*) FROM (select * from lotsofitext order by i, z) t;
select count(*) FROM (select * from lotsofitext order by i, z) t;
select count(*) FROM (select * from lotsofitext order by i, z) t;
select count(*) FROM (select * from lotsofitext order by i, z) t;

select count(*) FROM lotsofints;
CREATE INDEX ix_lotsofints ON lotsofints (i);
DROP INDEX ix_lotsofints;
CREATE INDEX ix_lotsofints ON lotsofints (i);
DROP INDEX ix_lotsofints;
CREATE INDEX ix_lotsofints ON lotsofints (i);
DROP INDEX ix_lotsofints;
CREATE INDEX ix_lotsofints ON lotsofints (i);
DROP INDEX ix_lotsofints;

select count(*) FROM lotsoftext;
CREATE INDEX ix_lotsoftext ON lotsoftext (i);
DROP INDEX ix_lotsoftext;
CREATE INDEX ix_lotsoftext ON lotsoftext (i);
DROP INDEX ix_lotsoftext;
CREATE INDEX ix_lotsoftext ON lotsoftext (i);
DROP INDEX ix_lotsoftext;
CREATE INDEX ix_lotsoftext ON lotsoftext (i);
DROP INDEX ix_lotsoftext;

select count(*) FROM lotsofitext;
CREATE INDEX ix_lotsofitext ON lotsofitext (i);
DROP INDEX ix_lotsofitext;
CREATE INDEX ix_lotsofitext ON lotsofitext (i);
DROP INDEX ix_lotsofitext;
CREATE INDEX ix_lotsofitext ON lotsofitext (i);
DROP INDEX ix_lotsofitext;
CREATE INDEX ix_lotsofitext ON lotsofitext (i);
DROP INDEX ix_lotsofitext;
CREATE INDEX ix_lotsofitext_ijwzz2 ON lotsofitext (i, j, w, z, z2);
DROP INDEX ix_lotsofitext_ijwzz2;
CREATE INDEX ix_lotsofitext_ijwzz2 ON lotsofitext (i, j, w, z, z2);
DROP INDEX ix_lotsofitext_ijwzz2;
CREATE INDEX ix_lotsofitext_ijwzz2 ON lotsofitext (i, j, w, z, z2);
DROP INDEX ix_lotsofitext_ijwzz2;
CREATE INDEX ix_lotsofitext_ijwzz2 ON lotsofitext (i, j, w, z, z2);
DROP INDEX ix_lotsofitext_ijwzz2;
CREATE INDEX ix_lotsofitext_zz2ijw ON lotsofitext (z, z2, i, j, w);
DROP INDEX ix_lotsofitext_zz2ijw;
CREATE INDEX ix_lotsofitext_zz2ijw ON lotsofitext (z, z2, i, j, w);
DROP INDEX ix_lotsofitext_zz2ijw;
CREATE INDEX ix_lotsofitext_zz2ijw ON lotsofitext (z, z2, i, j, w);
DROP INDEX ix_lotsofitext_zz2ijw;
CREATE INDEX ix_lotsofitext_zz2ijw ON lotsofitext (z, z2, i, j, w);
DROP INDEX ix_lotsofitext_zz2ijw;
CREATE INDEX ix_lotsofitext_zz2 ON lotsofitext (z, z2);
DROP INDEX ix_lotsofitext_zz2;
CREATE INDEX ix_lotsofitext_zz2 ON lotsofitext (z, z2);
DROP INDEX ix_lotsofitext_zz2;
CREATE INDEX ix_lotsofitext_zz2 ON lotsofitext (z, z2);
DROP INDEX ix_lotsofitext_zz2;
CREATE INDEX ix_lotsofitext_zz2 ON lotsofitext (z, z2);
DROP INDEX ix_lotsofitext_zz2;

