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 4
CREATE INDEX
customer_id | the_day | tsla_running_amount | goog_running_amount |
---|---|---|---|
a1b2c3 | 2020-04-01 | 10 | 5 |
a1b2c3 | 2020-04-02 | 10 | 5 |
a1b2c3 | 2020-04-03 | 30 | 13 |
a1b2c3 | 2020-04-04 | 30 | 13 |
a1b2c3 | 2020-04-05 | 30 | 13 |
a1b2c3 | 2020-04-06 | 30 | 13 |
a1b2c3 | 2020-04-07 | 30 | 13 |
a1b2c3 | 2020-04-08 | 30 | 13 |
a1b2c3 | 2020-04-09 | 30 | 13 |
a1b2c3 | 2020-04-10 | 30 | 13 |
SELECT 10