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?.
version |
---|
PostgreSQL 13.4 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1), 64-bit |
6 rows affected
id | lag | date_from | lead | cs | ce |
---|---|---|---|---|---|
1 | null | 2020-05-27 16:33:52+01 | 2020-06-11 20:12:18+01 | green | yellow |
1 | 2020-05-27 16:33:52+01 | 2020-06-11 20:12:18+01 | 2020-06-11 20:20:58+01 | yellow | red |
1 | 2020-06-11 20:12:18+01 | 2020-06-11 20:20:58+01 | null | red | green |
2 | null | 2020-08-06 14:59:21+01 | 2021-03-03 14:31:44+00 | green | yellow |
2 | 2020-08-06 14:59:21+01 | 2021-03-03 14:31:44+00 | null | yellow | red |
3 | null | 2021-04-28 12:36:45+01 | null | green | red |
id | Date from:/Date to: | Colour |
---|---|---|
1 | (,"2020-05-27 16:33:52+01") | green |
1 | ["2020-05-27 16:33:52+01","2020-06-11 20:12:18+01") | yellow |
1 | ["2020-06-11 20:12:18+01","2020-06-11 20:20:58+01") | red |
1 | ["2020-06-11 20:20:58+01",) | green |
2 | (,"2020-08-06 14:59:21+01") | green |
2 | ["2020-08-06 14:59:21+01","2021-03-03 14:31:44+00") | yellow |
2 | ["2021-03-03 14:31:44+00",) | red |
3 | (,"2021-04-28 12:36:45+01") | green |
3 | ["2021-04-28 12:36:45+01",) | red |
9 rows affected
id | df_dt | colour |
---|---|---|
2 | ["2021-03-03 14:31:44+00",) | red |
3 | ["2021-04-28 12:36:45+01",) | red |
colour | count |
---|---|
green | 2 |
yellow | 1 |