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?.
DROP TABLE
CREATE TABLE
INSERT 0 6
parent_id | child_id | level | entity |
---|---|---|---|
11 | 22 | 4 | a |
22 | 33 | 4 | a |
33 | 44 | 4 | a |
11 | 22 | 7 | b |
22 | 33 | 4 | b |
33 | 44 | 4 | b |
SELECT 6