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 10000
ANALYZE
CREATE INDEX
CREATE INDEX
CREATE TABLE
INSERT 0 10000
ANALYZE
CREATE INDEX
CREATE VIEW
CREATE TABLE
INSERT 0 2
ANALYZE
QUERY PLAN |
---|
Nested Loop (cost=0.29..359.16 rows=200 width=24) |
-> Seq Scan on some_ids i (cost=0.00..1.02 rows=2 width=8) |
-> Append (cost=0.29..178.56 rows=51 width=16) |
-> Index Scan using parta_payload_idx on parta (cost=0.29..8.30 rows=1 width=16) |
Index Cond: (payload = i.id) |
-> Seq Scan on partb (cost=0.00..170.00 rows=50 width=16) |
Filter: (i.id = NULL::bigint) |
EXPLAIN