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 1
INSERT 0 1
INSERT 0 1
id | name | description | slug | parent_id |
---|---|---|---|---|
1 | Sport | null | sport | null |
2 | Running | All plans related to running. | running | 1 |
999 | Sprinting | sprinting is fast running | sprinting | 2 |
SELECT 3
id | parent_id |
---|---|
999 | 2 |
2 | 1 |
1 | null |
SELECT 3
jsonb_pretty |
---|
{ "id": 999, "name": "Sprinting", "slug": "sprinting", "parent": { "id": 2, "name": "Running", "slug": "running", "parent": { "id": 1, "name": "Sport", "slug": "sport", "description": null }, "description": "All plans related to running." }, "description": "sprinting is fast running" } |
SELECT 1