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 3
INSERT 0 2
id | name |
---|---|
1 | John |
2 | Alice |
3 | Bob |
SELECT 3
id | value |
---|---|
1 | A |
1 | B |
SELECT 2
id | name | id | value |
---|---|---|---|
1 | John | 1 | A |
1 | John | 1 | B |
2 | Alice | null | null |
3 | Bob | null | null |
SELECT 4
id | name | id | value |
---|---|---|---|
1 | John | 1 | A |
SELECT 1
id | name | id | value |
---|---|---|---|
1 | John | 1 | A |
2 | Alice | null | null |
3 | Bob | null | null |
SELECT 3
id | name | id | value |
---|---|---|---|
1 | John | 1 | A |
SELECT 1