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 6
timestamp | type | value | source |
---|---|---|---|
2020-01-01 | 1 | 10 | 2 |
2020-01-01 | 2 | 20 | 2 |
2020-01-02 | 1 | 5 | 4 |
2020-01-02 | 2 | 6 | 3 |
2020-01-02 | 5 | 4 | 3 |
2020-01-02 | 4 | 8 | 1 |
SELECT 6
final_json |
---|
[{"2020-01-01" : [{"type" : 1, "value" : 10, "source" : 2}, {"type" : 2, "value" : 20, "source" : 2}]}, {"2020-01-02" : [{"type" : 1, "value" : 5, "source" : 4}, {"type" : 2, "value" : 6, "source" : 3}, {"type" : 5, "value" : 4, "source" : 3}, {"type" : 4, "value" : 8, "source" : 1}]}] |
SELECT 1