By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
CREATE FUNCTION
CREATE TABLE
INSERT 0 50000
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
ANALYZE
col1_notnull | col2_notnull | col3_notnull | col4_notnull | txt_notnull |
---|---|---|---|---|
50000 | 25000 | 10000 | 2500 | 50000 |
SELECT 1
size | col1_idx | col4_idx | col1234_idx | t12_idx | t34_idx |
---|---|---|---|---|---|
actual | 1138688 | 1138688 | 1900544 | 2039808 | 1679360 |
estimate | 1015808 | 1015808 | 1417216 | 1826816 | 1015808 |
SELECT 2
size | col1_idx | col2_idx | col1234_idx | t12_idx | t34_idx |
---|---|---|---|---|---|
actual | 1112 kB | 1112 kB | 1856 kB | 1992 kB | 1640 kB |
estimate | 992 kB | 992 kB | 1384 kB | 1784 kB | 992 kB |
SELECT 2