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 12
start_date | end_date | thediff |
---|---|---|
2017-06-01 | 2017-06-01 | 1 |
2017-06-17 | 2017-06-17 | 0 |
2017-06-01 | 2017-06-12 | 8 |
2017-06-01 | 2017-06-13 | 9 |
2017-06-01 | 2017-06-16 | 12 |
2017-06-01 | 2017-06-17 | 12 |
2017-06-01 | 2017-06-18 | 12 |
2017-06-03 | 2017-06-12 | 6 |
2017-06-03 | 2017-06-13 | 7 |
2017-06-03 | 2017-06-16 | 10 |
2017-06-03 | 2017-06-17 | 10 |
2017-06-03 | 2017-06-18 | 10 |
SELECT 12