Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-13906

N1QL query returns Index Scan timed out

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Critical
    • 4.0.0
    • 4.0.0
    • secondary-index
    • Security Level: Public
    • None
    • centos 3 node cluster (1Data, 1Data+Query, 1Data+Index); 1M documents
      Build 4.0.0-1510
    • Untriaged
    • Unknown

    Description

      simple query 'select `realm`, count from `bucket-1` group by `realm`.
      there is a 2i index by_realm on `realm`.
      query eventually starts streaming data but before finish reports:
      "errors": [

      { "code": 5000, "msg": "Index scan timed out" }

      ],
      "status": "errors",
      "metrics":

      { "elapsedTime": "4m19.596748705s", "executionTime": "4m19.596321823s", "resultCount": 670743, "resultSize": 41586066, "errorCount": 1 }

      workaround will be to reduce selectivity or use limit, but any query timeout should be user specifiable, and 4m shouldn't be the default!

      explain:
      cbq> explain select `realm`,count from `bucket-1` group by `realm`;
      {
      "requestID": "403fc452-7051-4a2f-aa0f-34a769703363",
      "signature": "json",
      "results": [
      {
      "#operator": "Sequence",
      "~children": [

      { "#operator": "PrimaryScan", "index": "#primary", "keyspace": "bucket-1", "namespace": "default", "using": "gsi" }

      ,
      {
      "#operator": "Parallel",
      "~child": {
      "#operator": "Sequence",
      "~children": [

      { "#operator": "Fetch", "keyspace": "bucket-1", "namespace": "default" }

      ,

      { "#operator": "InitialGroup", "aggregates": [ "count(*)" ], "group_keys": [ "(`bucket-1`.`realm`)" ] }

      ,

      { "#operator": "IntermediateGroup", "aggregates": [ "count(*)" ], "group_keys": [ "(`bucket-1`.`realm`)" ] }

      ]
      }
      },

      { "#operator": "IntermediateGroup", "aggregates": [ "count(*)" ], "group_keys": [ "(`bucket-1`.`realm`)" ] }

      ,

      { "#operator": "FinalGroup", "aggregates": [ "count(*)" ], "group_keys": [ "(`bucket-1`.`realm`)" ] }

      ,
      {
      "#operator": "Parallel",
      "~child": {
      "#operator": "Sequence",
      "~children": [
      {
      "#operator": "InitialProject",
      "result_terms": [

      { "expr": "(`bucket-1`.`realm`)" }

      ,

      { "expr": "count(*)" }

      ]
      },

      { "#operator": "FinalProject" }

      ]
      }
      }
      ]
      }
      ],
      "status": "success",
      "metrics":

      { "elapsedTime": "24.386309ms", "executionTime": "24.215223ms", "resultCount": 1, "resultSize": 3037 }

      }

      don't know which side times out, but it appears that 2i initiates

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              thomas Thomas Anderson (Inactive)
              thomas Thomas Anderson (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty