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 7
fruit_id | name1 | name2 | rating1 | rating2 | delivered_on | rush_order | fruit1_rating | fruit2_rating |
---|---|---|---|---|---|---|---|---|
1 | Apple | Banana | 5 | 4 | 2015-10-01 | yes | 0 | 0 |
2 | Pear | Banana | 3 | 4 | 2015-10-27 | yes | 0 | 0 |
3 | Apple | Pear | 5 | 4 | 2015-10-29 | no | 10 | 0 |
4 | Banana | Apple | 2 | 5 | 2015-11-27 | yes | 0 | 16 |
5 | Banana | Apple | 4 | 1 | 2015-11-29 | yes | 4 | 16 |
6 | Apple | Banana | 4 | 2 | 2015-12-02 | no | 10 | 12 |
7 | Pear | Apple | 3 | 5 | 2015-12-20 | yes | 6 | 0 |
SELECT 7