<@UDT7GFEG6> <@UDRLN8MAP> do you know *JSONPATHARR...
# general
t
@User @User do you know *JSONPATHARRAY*(jsonField, 'jsonPath') can be used in a WHERE clause to find out if the array contains a certain value?
j
I think you need to use
JsonExtractScalar
with an array type to extract a MV field
t
is there an example or syntax manual for this?
j
E.g.
where jsonExtractScalar(json, '$.a', 'STRING_ARRAY') = 'abc'
t
I suppose the above feature can not utilize Json index, right?
probably good for medium or small use cases
where jsonExtractScalar(json, '$.a', 'STRING_ARRAY') = 'abc'
the expression means the list contains a value
abc
?
j
Yes
Json index can be used to solve this problem
t
I am still a bit confused about which one to use in the where clause.
jsonExtractScalar
or
JSON_MATCH
j
If you have json index generated for the column,
JSON_MATCH
should be much faster
t
got it. thanks.