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

Intersect scan used for two similar partial indexes

    XMLWordPrintable

Details

    • Untriaged
    • 0
    • Unknown

    Description

      When two similar partial indexes are defined, the planner may choose an intersect scan with both indexes when using one of the indexes is more efficient:

      CREATE INDEX ix1 ON default(id) WHERE type = "type1";
      CREATE INDEX ix2 ON default(id, type) WHERE type NOT IN ["type2", "type3"];
       
      explain SELECT * FROM default WHERE type = "type1" AND id = $my_id;
      

      In this case using ix1 is better.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              PagerDuty