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
campaign | expected_inbound_date | expected_inbound_quantity | received_inbound_quantity | quantity_accumulated | quantity_total | split |
---|---|---|---|---|---|---|
C001 | 2022-05-03 | 200 | 0 | 200 | 700 | 200 |
C001 | 2022-05-03 | 400 | 0 | 600 | 700 | 400 |
C001 | 2022-05-03 | 500 | 0 | 1100 | 700 | 100 |
C001 | 2022-05-03 | 800 | 0 | 1900 | 700 | 0 |
C001 | null | 0 | 700 | 1900 | 700 | 0 |
C002 | 2022-08-20 | 2800 | 0 | 2800 | 4000 | 2800 |
C002 | 2022-08-20 | 3000 | 0 | 5800 | 4000 | 1200 |
C002 | 2022-08-20 | 5000 | 0 | 10800 | 4000 | 0 |
C002 | null | 0 | 4000 | 10800 | 4000 | 0 |
SELECT 9
campaign | exptected_inbound_date | expected_inbound_quantity | received_inbound_quantity | quantity_accumulated | quantity_total |
---|---|---|---|---|---|
C001 | 2022-05-03 | 200 | 0 | 200 | 700 |
C001 | 2022-05-03 | 400 | 0 | 600 | 700 |
C001 | 2022-05-03 | 500 | 0 | 1100 | 700 |
C001 | 2022-05-03 | 800 | 0 | 1900 | 700 |
C001 | null | 0 | 700 | 1900 | 700 |
C002 | 2022-08-20 | 2800 | 0 | 2800 | 4000 |
C002 | 2022-08-20 | 3000 | 0 | 5800 | 4000 |
C002 | 2022-08-20 | 5000 | 0 | 10800 | 4000 |
C002 | null | 0 | 4000 | 10800 | 4000 |
SELECT 9