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

Planner not picking covering index when index has complex WHERE clause

    XMLWordPrintable

Details

    • Untriaged
    • 0
    • Unknown

    Description

      The planner may not pick up a covering index if the index has complex WHERE clause.

      Repro:

      CREATE INDEX ishix3 ON default(c5, c6, c7, c8, c9);
      CREATE INDEX ishix4 ON default(c5, c8, c10) WHERE c6 != 1 AND c7 NOT IN [1,2] AND c11 != 0;
       
      explain SELECT 1 FROM default WHERE c5 = 10 AND c8 >= 11 AND c8 <= 20 AND c6 != 1 AND c7 NOT IN [1,2] AND c11 != 0;
      

      The planner picks ishix3. If forced, it can use ishix4:

      explain SELECT 1 FROM default USE INDEX (ishix4) WHERE c5 = 10 AND c8 >= 11 AND c8 <= 20 AND c6 != 1 AND c7 NOT IN [1,2] AND c11 != 0;
      

      Attachments

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

        Activity

          People

            ajay.bhullar Ajay Bhullar
            bingjie.miao Bingjie Miao
            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