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 9
year | avg |
---|---|
2022 | 120.0000000000000000 |
2023 | 100.0000000000000000 |
2021 | 250.0000000000000000 |
SELECT 3
UPDATE 6
month | year | sales | year_mean |
---|---|---|---|
1 | 2023 | 100 | null |
2 | 2023 | 100 | null |
3 | 2023 | 100 | null |
1 | 2021 | 100 | 120 |
2 | 2021 | 150 | 120 |
3 | 2021 | 500 | 120 |
1 | 2022 | 100 | 100 |
2 | 2022 | 140 | 100 |
3 | 2022 | 120 | 100 |
SELECT 9