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

Analytics fails to use indexes when faced with LIKE predicates

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Critical
    • Morpheus
    • 7.0.1
    • analytics
    • 0

    Description

      Consider travel sample with the following index:

      CREATE INDEX faa_index ON airport(faa: string);

      If you run the following queries using regular comparators the FAA index is used:

      SELECT * FROM airport WHERE faa = 'LAX';

      SELECT * FROM airport WHERE faa >= 'LAX';

      But if you run these closely related queries using LIKE the FAA index is NOT used:

      SELECT * FROM airport WHERE faa LIKE 'LAX';

      SELECT * FROM airport WHERE faa LIKE 'LAX%';

      Virtually every other database on the planet would use the index - Analytics needs to as well, as customers coming from the RDBMS world will expect it and be surprised and annoyed to discover that we currently don't do this.  (It surprised me while teaching not to long ago.)

      We should fix this ASAP, certainly before Goldfish ships, if we want to make a good first impression.

      For extra credit we should exploit the index even for "... LIKE '%LAX%" – it's still a significant query time-saver to scan the index leaves instead of the base collection.  (As a general practice we should push auxiliary predicate processing into our scans.)

      Attachments

        Issue Links

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

          Activity

            People

              wail.alkowaileet Wail Alkowaileet
              mike.carey Mike Carey
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty