N1QL query is taking too much time when running via Go SDK(gocb.v1) with Couchbase server 6.5

Hi,

We are using Couchbase 6.5 community addition with Go SDK 1.o in our application. We are seeing the random behavior of N1QL query with the response time varying from milliseconds to sometimes 10 seconds.

Here are further details.

  • Query Used: SELECT SDB.* FROM SDB WHERE tai = ‘987:654:003039’
  • RAM allocated for Data : 18291 MB Index : 512 MB Search : 512 MB
  • Around 100 documents are present in our bucket(SDB).

On further analysis of indexer logs we find out that the scenarios where the latency is random is when consistency is set to session_consistency for scan. We are not able to find how this is set for scans. We are creating two secondary indexes and for one (INDEX_NSSF_SDB_AMFINSTID) the consistency is set to any_consistency but for other one (INDEX_NSSF_SDB_TAC) its set to session_consistency. We suspect that the delay is because of this parameter but we don’t know how to change this to any_consistency. Please help.

Your responses will be highly appreciated.

Thanks and Regards,
Bharat Gupta

Use Index advisor and create right index. https://index-advisor.couchbase.com/indexadvisor/#1
If required use INDEX hint.