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

Adaptive index shouldn't use predicate on document key

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Major
    • bug-backlog
    • 5.0.0, 5.5.3, 6.0.1, 6.5.0
    • query
    • None
    • Untriaged
    • Unknown

    Description

      Adaptive index never indexes document key. The following query using document key for indexscan which result in 0 rows.

      CREATE INDEX report ON default(distinct pairs(self)) ;
      EXPLAIN SELECT * FROM default AS d WHERE meta(d).id="report_0000";
      {
              "plan": {
                  "#operator": "Sequence",
                  "~children": [
                      {
                          "#operator": "DistinctScan",
                          "scan": {
                              "#operator": "IndexScan3",
                              "as": "d",
                              "index": "report",
                              "index_id": "a1c30bd5256a6c51",
                              "index_projection": {
                                  "primary_key": true
                              },
                              "keyspace": "default",
                              "namespace": "default",
                              "spans": [
                                  {
                                      "exact": true,
                                      "range": [
                                          {
                                              "high": "[\"id\", \"report_0000\"]",
                                              "inclusion": 3,
                                              "low": "[\"id\", \"report_0000\"]"
                                          }
                                      ]
                                  }
                              ],
                              "using": "gsi"
                          }
                      },
                      {
                          "#operator": "Fetch",
                          "as": "d",
                          "keyspace": "default",
                          "namespace": "default"
                      },
                      {
                          "#operator": "Parallel",
                          "~child": {
                              "#operator": "Sequence",
                              "~children": [
                                  {
                                      "#operator": "Filter",
                                      "condition": "((meta(`d`).`id`) = \"report_0000\")"
                                  },
                                  {
                                      "#operator": "InitialProject",
                                      "result_terms": [
                                          {
                                              "expr": "self",
                                              "star": true
                                          }
                                      ]
                                  },
                                  {
                                      "#operator": "FinalProject"
                                  }
                              ]
                          }
                      }
                  ]
              },
              "text": "SELECT * FROM default AS d WHERE meta(d).id=\"report_0000\";"
          }
          ],
          "status": "success",
          "metrics": {
              "elapsedTime": "5.98893ms",
              "executionTime": "5.929722ms",
              "resultCount": 1,
              "resultSize": 2459
          }
      

      Attachments

        Issue Links

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

          Activity

            People

              keshav Keshav Murthy
              Sitaram.Vemulapalli Sitaram Vemulapalli
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty