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
CREATE TABLE
INSERT 0 4
INSERT 0 6
name |
---|
Anna |
Anna |
Denis |
SELECT 3
QUERY PLAN |
---|
Seq Scan on person_order (cost=0.00..291.32 rows=31 width=32) (actual time=0.018..0.024 rows=3 loops=1) |
Filter: (menu_id = ANY ('{13,14,18}'::integer[])) |
Rows Removed by Filter: 3 |
SubPlan 1 |
-> Index Scan using person_pkey on person (cost=0.15..8.17 rows=1 width=32) (actual time=0.003..0.003 rows=1 loops=3) |
Index Cond: (id = person_order.person_id) |
Planning Time: 0.084 ms |
Execution Time: 0.127 ms |
EXPLAIN
name |
---|
Anna |
Anna |
Denis |
SELECT 3
name |
---|
Anna |
Anna |
Denis |
SELECT 3
name |
---|
Anna |
Denis |
SELECT 2