0

I tried to make and run some N1QL query that find document some field is matched with element of variable array in query. but speed of the query is too slow. The query is like below.

select * from bucket where tp='type' and tm between 1484618520 and 1484618615 and nm='name' and checked=false and (bucket.gm in ["TEST","TEST2"])

["TEST","TEST2"] part is variable depend on condition.

I want to speedup this query.

How can I create index for this query including variable array?

Thanks.

1 Answer 1

1

I solved this problem by using below command.

create index new_index on bucket(gm,tp,tm,nm,checked) using gsi;

I set the "gm" field as leading key of new index.

Then the query speed was totally improved.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.