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

Incorrect index spans generated when bucket alias name matches one of the index keys

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 5.5.0
    • 5.0.0, 5.5.0
    • query
    • None
    • Untriaged
    • Unknown

    Description

      This maybe in earlier versions as well, I've not tested.

      CREATE INDEX ixCover on shellTest(f1, f2);

      EXPLAIN SELECT f2, f3 FROM shellTest f2 WHERE f1=5;

      gets this for index spans:

      \{
       "#operator": "IndexScan2",
       "index": "ixCover",
       "index_id": "59f63b0b4a477505",
       "index_projection": \{
       "primary_key": true
       },
       "keyspace": "shellTest",
       "namespace": "default",
       "spans": [
       \{
       "range": [
       \{
       "high": "5",
       "inclusion": 3,
       "low": "5"
       },
       \{
       "inclusion": 0,
       "low": "null"
       }
       ]
       }
       ],
       "using": "gsi"
       },
      

      Notes two spans are generated although only a single filter is present. The span for key f2 is "> null" which excludes NULL values, which is not what the query asked for.

       

      Similarly, this query:

      EXPLAIN SELECT f2, f3 FROM shellTest f1 WHERE f2=5;

      generates the following spans:

      \{
       "#operator": "IndexScan2",
       "index": "ixCover",
       "index_id": "59f63b0b4a477505",
       "index_projection": \{
       "primary_key": true
       },
       "keyspace": "shellTest",
       "namespace": "default",
       "spans": [
       \{
       "range": [
       \{
       "inclusion": 0,
       "low": "null"
       },
       \{
       "high": "5",
       "inclusion": 3,
       "low": "5"
       }
       ]
       }
       ],
       "using": "gsi"
       },
      

      again two spans are generated from a single filter, this time excluding the NULL values on f1.

      Attachments

        Issue Links

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

          Activity

            People

              bingjie.miao Bingjie Miao
              bingjie.miao Bingjie Miao
              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