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 6
objekt_id | id | rental_start | rental_end | contract_id | last_contract_id | next_contract_id |
---|---|---|---|---|---|---|
77920 | 1 | 2017-11-01 | 2021-12-31 | null | null | 802 |
77920 | 2 | 2022-01-01 | 2023-04-30 | 802 | null | null |
77920 | 3 | 2023-05-01 | 2023-05-31 | null | 802 | 803 |
77920 | 4 | 2023-06-01 | 2100-01-01 | 803 | null | null |
77920 | 5 | 2023-06-01 | 2100-01-01 | 806 | null | null |
77920 | 6 | 2023-06-01 | 2100-01-01 | 807 | null | null |
SELECT 6