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?.
SELECT 100000
DELETE 10125
VACUUM
count | count |
---|---|
9999 | 5 |
SELECT 1
lots | few |
---|---|
2345 | 2 |
SELECT 1
CREATE INDEX
QUERY PLAN |
---|
Index Only Scan using tbl_lf_idx on tbl (cost=0.29..4.33 rows=2 width=8) (actual rows=1 loops=1) |
Index Cond: ((lots = 2345) AND (few = 2)) |
Heap Fetches: 0 |
Planning Time: 0.312 ms |
Execution Time: 0.073 ms |
EXPLAIN
QUERY PLAN |
---|
Index Only Scan using tbl_lf_idx on tbl (cost=0.29..4.33 rows=2 width=8) (actual rows=1 loops=1) |
Index Cond: ((lots = 2345) AND (few = 2)) |
Heap Fetches: 0 |
Planning Time: 0.050 ms |
Execution Time: 0.022 ms |
EXPLAIN
DROP INDEX
CREATE INDEX
QUERY PLAN |
---|
Index Only Scan using tbl_fl_idx on tbl (cost=0.29..4.33 rows=2 width=8) (actual rows=1 loops=1) |
Index Cond: ((few = 2) AND (lots = 2345)) |
Heap Fetches: 0 |
Planning Time: 0.214 ms |
Execution Time: 0.195 ms |
EXPLAIN
QUERY PLAN |
---|
Index Only Scan using tbl_fl_idx on tbl (cost=0.29..4.33 rows=2 width=8) (actual rows=1 loops=1) |
Index Cond: ((few = 2) AND (lots = 2345)) |
Heap Fetches: 0 |
Planning Time: 0.173 ms |
Execution Time: 0.022 ms |
EXPLAIN