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 4
CREATE TABLE
INSERT 0 4
id | user_id | name | created_at | t2_created_at |
---|---|---|---|---|
1 | 11 | A | 2023-01-01 12:00:00 | 2023-01-01 12:05:00 |
2 | 11 | B | 2023-01-01 12:08:00 | null |
3 | 22 | C | 2023-01-01 13:00:00 | 2023-01-01 13:03:00 |
4 | 33 | D | 2023-01-01 14:00:00 | 2023-01-01 14:12:00 |
SELECT 4