Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This advisor message is returned when a query uses the ARRAY_CONTAINS function with partial matching. The message clarifies the reason and provides guidance to improve query performance.
Properties
| Value | |
|---|---|
| RuleID | QA1000 |
| Title | PartialArrayContains |
| Category | Performance |
Cause
The query uses ARRAY_CONTAINS with the third argument set to true, which checks for a partial match.
Rule Description
Using ARRAY_CONTAINS for partial matches can lead to inefficient query execution.
Recommendation
Replace ARRAY_CONTAINS with VALUE EXISTS and a subquery for better performance.
Example
Consider this original query:
SELECT VALUE ARRAY_CONTAINS(c.auditEvents, {"type":"invoice","status":"Success"}, true)
FROM c
Then use the following updated query:
SELECT VALUE EXISTS
(
SELECT VALUE t
FROM t IN c.auditEvents
WHERE t.type = "invoice" AND t.status = "success"
)
FROM c