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 7
id | name | parent_id |
---|---|---|
1 | adam | null |
2 | eva | null |
3 | peter | 2 |
4 | pan | 3 |
5 | arthur | 1 |
6 | ford | 5 |
7 | tricia | 4 |
SELECT 7
DELETE 1
id | name | parent_id |
---|---|---|
1 | adam | null |
2 | eva | null |
5 | arthur | 1 |
6 | ford | 5 |
SELECT 4