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?.
id | name | start | end | count |
---|---|---|---|---|
1 | A | 2018-01-09 17:00:00 | 2018-01-09 20:00:00 | 34 |
2 | B | 2018-01-09 18:00:00 | 2018-01-09 23:00:00 | 19 |
3 | C | 2018-01-09 19:00:00 | 2018-01-09 20:30:00 | 56 |
4 | D | 2018-01-09 22:00:00 | 2018-01-09 23:30:00 | 43 |
SELECT 4
greatest | least | array_agg | sum |
---|---|---|---|
2018-01-09 19:00:00 | 2018-01-09 20:00:00 | {A,B,C} | 109 |
2018-01-09 18:00:00 | 2018-01-09 19:00:00 | {A,B} | 53 |
2018-01-09 20:00:00 | 2018-01-09 20:30:00 | {B,C} | 75 |
2018-01-09 22:00:00 | 2018-01-09 23:00:00 | {B,D} | 62 |
SELECT 4