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

Add unwinding to collection operator IN clause support for optimizer

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • None
    • 4.6.0
    • query

    Description

      Consider the following query which executes using an index:

      SELECT modelID FROM `default`
      WHERE ANY v IN modelTypeID
      SATISFIES (v.brandID = 1 OR v.brandID = 2 or v.brandID = 3) END

      Index definition:

      CREATE INDEX `modelID` ON `default`(DISTINCT (ARRAY `v` FOR `v` IN `modelTypeIDs` END))

      This simplified version of the query will also execute, but it will not use anything other than a primary index:

      SELECT modelID FROM `default` 
      WHERE ANY v IN modelTypeID 
      SATISFIES (v.brandID IN [1,2,3]) END

      After a discussion with Marco Greco, he suggested a convenience improvement could be supporting unwinding automatically so the optimizer utilizes an index.  

      Attachments

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

        Activity

          People

            keshav Keshav Murthy
            tgreenstein Todd Greenstein [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty