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

IN contains query parameter generate precise spans

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 4.5.1, 5.0.0
    • 4.5.1, 5.0.0
    • query
    • None

    Description

      one of the element inside IN clause has query parameter we choose FULL_SPAN (we may not able to eliminate duplicates). If the query is rewritten as OR clause it uses precise spans.
      If possible we should do same for IN.

      create index ix1 on default(x);
      explain select x from default where x in ["5", $1];
       {
                              "#operator": "IndexScan",
                              "covers": [
                                  "cover ((`default`.`x`))",
                                  "cover ((meta(`default`).`id`))"
                              ],
                              "index": "ix1",
                              "index_id": "bbbba8a92f99a",
                              "keyspace": "default",
                              "namespace": "default",
                              "spans": [
                                  {
                                      "Range": {
                                          "Inclusion": 0,
                                          "Low": [
                                              "null"
                                          ]
                                      }
                                  }
                              ],
                              "using": "gsi"
                          },
      explain select x from default where x =5 OR x = $1 ;{
                              "#operator": "DistinctScan",
                              "scan": {
                                  "#operator": "IndexScan",
                                  "covers": [
                                      "cover ((`default`.`x`))",
                                      "cover ((meta(`default`).`id`))"
                                  ],
                                  "index": "ix1",
                                  "index_id": "bbbba8a92f99a",
                                  "keyspace": "default",
                                  "namespace": "default",
                                  "spans": [
                                      {
                                          "Range": {
                                              "High": [
                                                  "5"
                                              ],
                                              "Inclusion": 3,
                                              "Low": [
                                                  "5"
                                              ]
                                          }
                                      },
                                      {
                                          "Range": {
                                              "High": [
                                                  "$1"
                                              ],
                                              "Inclusion": 3,
                                              "Low": [
                                                  "$1"
                                              ]
                                          }
                                      }
                                  ],
                                  "using": "gsi"
                              }
                          },
      
      

      Attachments

        Issue Links

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

          Activity

            People

              Prerna.Manaktala Prerna Manaktala (Inactive)
              Sitaram.Vemulapalli Sitaram Vemulapalli
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty