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 5
id | stuff | key |
---|---|---|
1 | {"country": "brazil"} | country |
2 | {"city": "amsterdam"} | city |
3 | {"count": 10} | count |
4 | {"pearl": "jam", "counting": "crows"} | pearl |
4 | {"pearl": "jam", "counting": "crows"} | counting |
5 | {"count": "chocula", "count down": "final"} | count |
5 | {"count": "chocula", "count down": "final"} | count down |
SELECT 7
id | stuff | key | value |
---|---|---|---|
1 | {"country": "brazil"} | country | "brazil" |
3 | {"count": 10} | count | 10 |
4 | {"pearl": "jam", "counting": "crows"} | counting | "crows" |
5 | {"count": "chocula", "count down": "final"} | count | "chocula" |
5 | {"count": "chocula", "count down": "final"} | count down | "final" |
SELECT 5
id | stuff |
---|---|
1 | {"country": "brazil"} |
3 | {"count": 10} |
4 | {"pearl": "jam", "counting": "crows"} |
5 | {"count": "chocula", "count down": "final"} |
SELECT 4