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 10
id | name | depth |
---|---|---|
2 | P2 | 1 |
3 | P3 | 1 |
4 | P4 | 1 |
5 | P5 | 2 |
6 | P6 | 2 |
7 | P7 | 2 |
8 | P8 | 2 |
9 | P9 | 2 |
10 | P10 | 2 |
SELECT 9