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

[BP to 7.0.5 MB-49753 ] - cover is missing in lookup JOIN operator

    XMLWordPrintable

Details

    • Untriaged
    • 1
    • Unknown

    Description

      create index ix30 on default(docid) WHERE type = "xyz";
       explain select 1 FROM default s inner JOIN default j ON meta(j).id = s.docid AND s.type = j.type WHERE s.type = "xyz";
      {
          "requestID": "5a56dca2-1dfc-4c5e-ba8d-553d70978b67",
          "signature": "json",
          "results": [
          {
              "plan": {
                  "#operator": "Sequence",
                  "~children": [
                      {
                          "#operator": "IndexScan3",
                          "as": "s",
                          "covers": [
                              "cover ((`s`.`docid`))",
                              "cover ((meta(`s`).`id`))"
                          ],
                          "filter": "((cover ((`s`.`type`)) = \"xyz\") and (cover ((`s`.`docid`)) is not null))",
                          "filter_covers": {
                              "cover ((`s`.`type`))": "xyz"
                          },
                          "index": "ix30",
                          "index_id": "91b2d0e152eca069",
                          "index_projection": {
                              "entry_keys": [
                                  0
                              ]
                          },
                          "keyspace": "default",
                          "namespace": "default",
                          "spans": [
                              {
                                  "exact": true,
                                  "range": [
                                      {
                                          "inclusion": 0,
                                          "index_key": "`docid`",
                                          "low": "null"
                                      }
                                  ]
                              }
                          ],
                          "using": "gsi"
                      },
                      {
                          "#operator": "Join",
                          "as": "j",
                          "keyspace": "default",
                          "namespace": "default",
                          "on_filter": "((`s`.`type`) = (`j`.`type`))",
                          "on_keys": "cover ((`s`.`docid`))"
                      },
                      {
                          "#operator": "Parallel",
                          "~child": {
                              "#operator": "Sequence",
                              "~children": [
                                  {
                                      "#operator": "InitialProject",
                                      "result_terms": [
                                          {
                                              "expr": "1"
                                          }
                                      ]
                                  }
                              ]
                          }
                      }
                  ]
              },
              "text": "select 1 FROM default s inner JOIN default j ON meta(j).id = s.docid AND s.type = j.type WHERE s.type = \"xyz\";"
          }
          ],
          "status": "success",
          "metrics": {
              "elapsedTime": "3.660792ms",
              "executionTime": "3.565318ms",
              "resultCount": 1,
              "resultSize": 2460,
              "serviceLoad": 2
          }
      }
      

      right side of join is document key, so transformed ON KEYS JOIN.
      Left side is covered. Missing the cover in JOIN operator on_filter around s.type.

       
                      {
                          "#operator": "Join",
                          "as": "j",
                          "keyspace": "default",
                          "namespace": "default",
                          "on_filter": "((`s`.`type`) = (`j`.`type`))",
                          "on_keys": "cover ((`s`.`docid`))"
                      },
      

      cc Bingjie Miao

      Attachments

        Issue Links

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

          Activity

            People

              pierre.regazzoni Pierre Regazzoni
              bingjie.miao Bingjie Miao
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty