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?.
tstzrange |
---|
["2024-02-20 22:00:00+00","2024-02-21 03:00:00+00") |
SELECT 1
CREATE TYPE
row |
---|
(22:00:00,03:00:00) |
SELECT 1
CREATE TABLE
tr |
---|
(22:00:00,03:00:00) |
(04:00:00,05:30:00) |
INSERT 0 2
tr | start_time | end_time | starts late, ends early | 3 o'clock in range | 3 o'clock in range, correct |
---|---|---|---|---|---|
(22:00:00,03:00:00) | 22:00:00 | 03:00:00 | t | f | t |
(04:00:00,05:30:00) | 04:00:00 | 05:30:00 | f | f | f |
SELECT 2
CREATE TYPE
CREATE TABLE
tr2 |
---|
(22:00:00,05:00:00) |
(04:00:00,01:30:00) |
INSERT 0 2
tr2 | start_time | duration | end_time | 2 o'clock in range |
---|---|---|---|---|
(22:00:00,05:00:00) | 22:00:00 | 05:00:00 | 03:00:00 | f |
(04:00:00,01:30:00) | 04:00:00 | 01:30:00 | 05:30:00 | f |
SELECT 2