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 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
product | _date | in_promo | days_since_last_promo |
---|---|---|---|
1 | 2023-10-01 | false | null |
1 | 2023-10-02 | false | null |
1 | 2023-10-03 | true | 1 |
1 | 2023-10-04 | true | 2 |
1 | 2023-10-05 | true | 3 |
1 | 2023-10-06 | false | 4 |
1 | 2023-10-07 | false | 5 |
1 | 2023-10-08 | true | 1 |
1 | 2023-10-09 | true | 2 |
1 | 2023-10-10 | false | 3 |
2 | 2023-10-01 | true | 1 |
2 | 2023-10-02 | false | 2 |
2 | 2023-10-03 | false | 3 |
2 | 2023-10-04 | true | 1 |
SELECT 14