N1QL Queries running slow - how to index?


#1
 The following query takes in average 10 seconds to run on a 5 server Cluster vs 22ms in MySQL on the same data set. 

String retrieveQuery = “SELECT * FROM devalf WHERE phase = '”+ phase +
"'AND application = ‘" + application + "’ AND " + “((startTime <=” + startTime + " AND endTime >=" +startTime + “) " + “OR(startTime <=” + endTime + " AND endTime >=” + endTime+ ") " + “OR(startTime >=” + startTime + “AND endTime <=” +endTime + “))”;

Created the following index but no improvement:
CREATE INDEX ALF_FILE_SEARCH ON
devalf(phase,application,startTime,endTime)

In Web Console I can see:
VIEW STATS: _DESIGN/DDL_ALF_FILE_SEARCH

Any ideas please ?
Thank you.


#2

When using explain, can you tell if it is using your index?


#3

Hi Do you have an explain output we can look at?