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
INSERT 0 1
INSERT 0 1
entity_id | height | weight | updated_at |
---|---|---|---|
1 | 140 | 30 | 2021-01-01 00:00:00 |
1 | 145 | 30 | 2021-02-01 00:00:00 |
1 | 145 | 34 | 2021-03-01 00:00:00 |
1 | null | 140 | 2021-04-01 00:00:00 |
SELECT 4
entity_id | column_id | value | updated_at |
---|---|---|---|
1 | height | 140 | 2021-01-01 00:00:00 |
1 | weight | 30 | 2021-01-01 00:00:00 |
1 | height | 145 | 2021-02-01 00:00:00 |
1 | weight | 34 | 2021-03-01 00:00:00 |
1 | weight | 140 | 2021-04-01 00:00:00 |
SELECT 5
entity_id | updated_at | height | weight |
---|---|---|---|
1 | 2021-01-01 00:00:00 | 140 | 30 |
1 | 2021-02-01 00:00:00 | 145 | 30 |
1 | 2021-03-01 00:00:00 | 145 | 34 |
1 | 2021-04-01 00:00:00 | 145 | 140 |
SELECT 4