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 5
stock_date | inbound_quantity | outbound_quantity | balance |
---|---|---|---|
2020-01-01 | 900 | 0 | 900 |
2020-01-02 | 0 | 300 | 600 |
2020-01-03 | 400 | 250 | 750 |
2020-01-04 | 0 | 100 | 650 |
2020-01-05 | 700 | 500 | 850 |
SELECT 5