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?.
select *
from jsonb_array_elements('{
"a": [
{
"b": {"x": 1},
"c": 2
},
{
"b": {"y": 2},
"d": 3
},
{
"b": {"x": 2},
"d": 4
}
]
}'::jsonb->'a') jae (obj)
where (obj->'b'->'x')::int = 2;
obj |
---|
{"b": {"x": 2}, "d": 4} |