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

Relax Adaptive Index restrictions on where clause predicates

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Won't Fix
    • Major
    • feature-backlog
    • 6.0.0
    • query
    • None

    Description

      Taking the example from the docs at https://docs.couchbase.com/server/6.0/n1ql/n1ql-language-reference/adaptive-indexing.html, we can create an adaptive index like the following:

      CREATE INDEX `ai_airport_day_faa`
          ON `travel-sample`(DISTINCT PAIRS({airportname, city, faa}));
      

      This can serve queries like the following, with a fetch phase:

      SELECT meta().id FROM `travel-sample` WHERE city="foo" and airportname="bar";
      

      However, the following query cannot use the adaptive index, despite the index containing all of the necessary information to provide the correct results:

      SELECT meta().id FROM `travel-sample` WHERE city="foo" and airportname="bar" and other_field="baz";
      

      It would be good if the query engine realized that it could use the adaptive index to serve the query which has a field not in the index (which will be part of the fetched document).

      Attachments

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

        Activity

          People

            keshav Keshav Murthy
            matt.carabine Matt Carabine (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty