Re:Better JSON in Postgres with PostgreSQL 14
by atonse on Tuesday June 01, 2021 @03:46PM
(#27360240)
Does anyone know why "col->'blah'->'blah2' = 'value';" ignores the index whereas @> uses it?
[ Parent
| on HN ]
Re:Better JSON in Postgres with PostgreSQL 14
by jkatz05 on Tuesday June 01, 2021 @03:55PM
(#27360357)
"@>" is one of the operators for the GIN index, which is what Postgres uses for the JSONB type.
Ref: https://www.postgresql.org/docs/current/gin-builtin-opclasse...
Re:Better JSON in Postgres with PostgreSQL 14
by atonse on Tuesday June 01, 2021 @03:57PM
(#27360400)
Just feels like it would be nice to have some syntactic sugar to convert these expressions.
Re:Better JSON in Postgres with PostgreSQL 14
by bhaney on Tuesday June 01, 2021 @04:06PM
(#27360555)
GIN indices in general support the @> operator but not the = operator, unrelated to JSON.
You can create a regular btree index on a particular json path and get an index usable for = operations on that path.