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 t (id varchar(30), jsonColumn jsonb);
INSERT INTO t VALUES('ID1123312','{
"a": [
{
"a1": "2022-01-01",
"a2": "2026-01-31",
"a3": 1
}
],
"b": [
{
"b1": "J",
"b2": "1231342138adc2fehj3j21321321321kjk1423j32k9"
}
],
"c": [
{
"c1-1": "2021-02-01",
"c1-2": "2021-01-01"
},
{
"c2-1": "2021-04-01",
"c2-2": "2021-03-01"
}
]
}')
CREATE TABLE
INSERT 0 1
SELECT t.jsonColumn->'b'->0->>'b2'
FROM t
WHERE t.jsonColumn->'b'->0->>'b2' = '1231342138adc2fehj3j21321321321kjk1423j32k9'
?column? |
---|
1231342138adc2fehj3j21321321321kjk1423j32k9 |
SELECT 1