5 ms·
Does anyone know why "col->'blah'->'blah2' = 'value';" ignores the index whereas @> uses it?
by atonse 5y ago
Does anyone know why "col->'blah'->'blah2' = 'value';" ignores the index whereas @> uses it?
- jkatz05 5y ago"@>" 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-opclasses.html https://www.postgresql.org/docs/current/gin-builtin-opclasse...
- atonse 5y agoJust feels like it would be nice to have some syntactic sugar to convert these expressions.
- bhaney 5y agoGIN 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.