N1QL Error Index scan timed out - cause: Index scan timed out

冷暖自知 提交于 2019-12-11 00:01:00

问题


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?

回答1:


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>.)



来源:https://stackoverflow.com/questions/38781355/n1ql-error-index-scan-timed-out-cause-index-scan-timed-out

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!