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 TABLE
INSERT 0 1000000
CREATE INDEX
QUERY PLAN |
---|
Nested Loop (cost=0.43..59.27 rows=1 width=12) (actual time=0.055..15.267 rows=1762 loops=1) |
Buffers: shared hit=295 read=1435 written=240 |
-> Function Scan on unnest u (cost=0.00..0.07 rows=7 width=4) (actual time=0.007..0.014 rows=7 loops=1) |
-> Index Only Scan using table_idx on table1 t (cost=0.42..8.45 rows=1 width=12) (actual time=0.022..2.117 rows=252 loops=7) |
Index Cond: ((col1 = 2) AND (col2 = 12) AND (col3 = u.c3val)) |
Heap Fetches: 1762 |
Buffers: shared hit=295 read=1435 written=240 |
Planning: |
Buffers: shared hit=62 read=4 |
Planning Time: 0.427 ms |
Execution Time: 15.658 ms |
EXPLAIN