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 EXTENSION
CREATE TABLE
INSERT 0 6
neighborhood | bedrooms | avg |
---|---|---|
downtown | 0 | 189000 |
downtown | 1 | 325000 |
downtown | 3 | 450000 |
riverview | 0 | 250000 |
riverview | 1 | 300000 |
riverview | 2 | 350000 |
SELECT 6
neighborhood | 0 | 1 | 2 | 3 |
---|---|---|---|---|
downtown | 189000 | 325000 | null | 450000 |
riverview | 250000 | 300000 | 350000 | null |
SELECT 2
neighborhood | 0 | 1 | 2 | 3 |
---|---|---|---|---|
downtown | 189000 | 325000 | null | 450000 |
riverview | 250000 | 300000 | 350000 | null |
SELECT 2