2

I'm facing an issue on couchbase 4.1.0 running a query through CBQ against about 20 Million documents. When executing my query this error is printed after a 2 minute timeout:

"code": 12015,

"msg": "Index scan timed out - cause: Index scan timed out".

My questions are this

  1. What is an index scan (is this a scan looking for the appropriate index to use or something?
  2. What causes such an error
  3. Is querying a dataset of this size beyond the capabilities of couchbase?
Community
  • 1
  • 1
Marquis Blount
  • 7,585
  • 8
  • 43
  • 67

1 Answers1

2

An index scan is the process of looking for your query predicate in the index. E.g. if you have a field named "a" and an index on this field called "ix_a", the query "SELECT * FROM bucket where A = 123" would perform an index scan on the index ix_a to look for the value 123. As Gerald pointed out in a comment, the default index scan timeout is 2 minutes. This can be adjusted in the settings.

This error can be caused by the index node being undersized, such as not enough RAM so the index is mostly read from disk, especially if the indexed field is very large. Or by the server being busy. In 4.1.0 a COUNT(*) query also performs an index scan, so it would effectively go over the entire primary index and count all items.

Querying 20m items is well within the capabilities of Couchbase Server, but you have to put some thought into designing your indexes correctly to ensure that the query will perform well.

This is a very generic answer. It would help if you could post both your query and the query execution plan. (To get the execution plan, run the following command in N1QL: EXPLAIN <your query>.)

David Ostrovsky
  • 2,461
  • 12
  • 13
  • David, the default index scan timeout is 2 minutes. There is an indexer setting to adjust this, which would be good to add to your answer. – geraldss Aug 05 '16 at 18:48
  • I encounter index scan timeout problem also, even the index size is less than 50m, by double the existing **Index RAM Quota**, the timeout problem seems gone – Guizhou Feng May 14 '20 at 04:06