Reputation: 8115
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
Upvotes: 2
Views: 2282
Reputation: 2481
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>
.)
Upvotes: 2