Hi all,
I am using Couchbase Version: 4.5.1-2844 Enterprise Edition (build-2844)
Cluster State ID: 038-170-F17
I am doing 12 n1ql queries, using the java Couchbase client v2.4.2, from 12 different document types for items containing ids, start and end times and combining them into a list ordered by accending start time.
The queries are very basic:
"select * from write where docType = ‘$1’ and id = $2;’
I sort the results using java rather than adding the ordering to the n1ql queries.
The items have other fields which are all string values. The maximun number of fields in each item <= 20
Each query would return a maximum number of items < 100.
If I want to increase the performance of the queries:
-
Should I combine them into one query with the ordering by start time?
-
Should I leave the queries as is and create indexes for each of the individual queries?
I have noticed that if there are a lot of items between the start and end time, the first time the queries are run it can be slow(40 seconds) but the next time it is considerably faster(2 seconds) and
all the times after the initial time are equally fast.
However, if I wait for 15 minutes and run the same query again, it is as slow as the first time. The next time it is considerably faster and
all the times after the initial time are equally fast.
I tried looking in the documentation about this issue and on this forum but I couldn’t find any information.
Is there some documentation or white paper available that may help me better understand or debug why this issue is occurring for me?
Any help would be greatly appreciated.
Regards,
Damian.