subqueries are evaluated at execution and plan generated at prepare time. If the index key values are not constants it uses prepare time.
You can use CB 5.5 and use ANSI JOINS
Subquery works but not efficient due to values are not constants and due to that not able to pass it indexer query requires do full indexscan and apply predicates
Req 1
SELECT RAW transco from products transco
USE KEYS [‘KEYS/key1’]
Req2
Use output from Req1 as named or query parameters with adhoc=true from SDKs
SELECT * from default
WHERE ANY k IN key
SATISFIES k IN $keys
END
I tired the LET clause, as the documentation say that :
If the LET variable is referenced in the WHERE clause, then it is evaluated before the WHERE clause
But it is still not working. Here is the query :
SELECT * from default
LET `keys` = ARRAY_FLATTEN((SELECT RAW transco from products transco USE KEYS [‘KEYS/key1’] ),2)
WHERE ANY k IN key
SATISFIES k IN `keys`
END
Can you more specific?
Query optimizer decides plan during prepare time and decides which one push to indexer. Only constants can pushed to indexer. In your case keys are not a constant. The needs to be evaluated at the runtime. So it needs to do full index scan.