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 6
INSERT 0 5
item_id | tree |
---|---|
1 | { "title": "PARENT", "item_id": 1, "children": [ { "title": "LEVEL 2", "item_id": 2, "children": [ { "title": "LEVEL 3.1", "item_id": 3, "children": [ { "title": "LEVEL 4.1", "item_id": 4 }, { "title": "LEVEL 4.2", "item_id": 5 } ] }, { "title": "LEVEL 3.2", "item_id": 6 } ] } ] } |
SELECT 1
item_id | tree |
---|---|
1 | { "title": "PARENT", "item_id": 1, "children": [ { "title": "LEVEL 2", "item_id": 2, "children": [ { "title": "LEVEL 3.1", "item_id": 3, "children": [ { "title": "LEVEL 4.1", "item_id": 4 }, { "title": "LEVEL 4.2", "item_id": 5 } ] }, { "title": "LEVEL 3.2", "item_id": 6 } ] } ] } |
SELECT 1