SELECT x.* FROM default a use keys “xyz_12”
join default x ON keys ARRAY a.docid || “_” || TOSTRING(sub) for sub in ARRAY_RANGE(0,a.subDocIndex) END
trying to improve above query performance, is it array index improves the performance ?
SELECT x.* FROM default a use keys “xyz_12”
join default x ON keys ARRAY a.docid || “_” || TOSTRING(sub) for sub in ARRAY_RANGE(0,a.subDocIndex) END
trying to improve above query performance, is it array index improves the performance ?
This query will not use any index due to USE KEYS, ON KEYS.
is there any alternatives to improve performance ?
You can try this
SELECT RAW t
FROM default AS t
USE KEYS ARRAY_FLATTEN((SELECT ARRAY a.docid || "_" || TOSTRING(sub) FOR sub IN ARRAY_RANGE(0,a.subDocIndex) END
FROM a USE KEYS "xyz_12")
);