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 2
CREATE FUNCTION
id | top | top_timestamp |
---|---|---|
some-id | 121 | 888 |
SELECT 1
id | top | top_timestamp |
---|---|---|
some-id | 123 | 999 |
SELECT 1
id | top | top_timestamp |
---|---|---|
next-id | 100 | 666 |
some-id | 123 | 999 |
SELECT 2
id | top | top_timestamp |
---|---|---|
null | null | null |
SELECT 1
id | top | top_timestamp |
---|---|---|
new-id | 1 | 1 |
SELECT 1
id | top | top_timestamp |
---|---|---|
new-id | 2 | 2 |
SELECT 1
id | top | top_timestamp |
---|---|---|
next-id | 100 | 666 |
some-id | 123 | 999 |
new-id | 2 | 2 |
SELECT 3
id | top |
---|---|
new-id | 2 |
SELECT 1