DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (id integer);
INSERT INTO t1 SELECT generate_series(1, 10_000_000);
VACUUM ANALYZE t1;

SELECT relname, seq_scan, last_seq_scan, parallel_seq_scan, last_parallel_seq_scan FROM pg_stat_user_tables WHERE relname='t1' \gx
SELECT * FROM t1 LIMIT 1;
\o /dev/null
SELECT pg_sleep(1);
\o
SELECT relname, seq_scan, last_seq_scan, parallel_seq_scan, last_parallel_seq_scan FROM pg_stat_user_tables WHERE relname='t1' \gx
SELECT count(*) FROM t1;
\o /dev/null
SELECT pg_sleep(1);
\o
SELECT relname, seq_scan, last_seq_scan, parallel_seq_scan, last_parallel_seq_scan FROM pg_stat_user_tables WHERE relname='t1' \gx

CREATE INDEX ON t1(id);

SELECT indexrelname,idx_scan,last_idx_scan,parallel_idx_scan,last_parallel_idx_scan,idx_tup_read,idx_tup_fetch FROM pg_stat_user_indexes WHERE relname='t1' \gx
SELECT * FROM t1 WHERE id=150000;
\o /dev/null
SELECT pg_sleep(1);
\o
SELECT indexrelname,idx_scan,last_idx_scan,parallel_idx_scan,last_parallel_idx_scan,idx_tup_read,idx_tup_fetch FROM pg_stat_user_indexes WHERE relname='t1' \gx
\o /dev/null
SELECT * FROM t1 WHERE id BETWEEN 100000 AND 400000;
\o
SELECT pg_sleep(1);
SELECT indexrelname,idx_scan,last_idx_scan,parallel_idx_scan,last_parallel_idx_scan,idx_tup_read,idx_tup_fetch FROM pg_stat_user_indexes WHERE relname='t1' \gx
SELECT count(*) FROM t1 WHERE id BETWEEN 100000 AND 400000;
\o /dev/null
SELECT pg_sleep(1);
\o
SELECT indexrelname,idx_scan,last_idx_scan,parallel_idx_scan,last_parallel_idx_scan,idx_tup_read,idx_tup_fetch FROM pg_stat_user_indexes WHERE relname='t1' \gx
