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

Index is not used - parameterized queries

    XMLWordPrintable

Details

    • Bug
    • Resolution: Resolved
    • Major
    • feature-backlog
    • 4.6.1
    • query
    • None
    • Untriaged
    • No

    Description

      When this query is used, couchbase is performing full data scan (index is not used)

      var query = n1qlQuery.fromString("SELECT LOWER(e1.color) as color, e2.* FROM xxx e1 JOIN xxx e2 ON KEYS e1.person_id WHERE e1.type = $1 AND e1.person_id = $2"); bucket.query(query, ["alert", personId], function(err, person) {} )

       

      But when query is structured in this way, index is used

      var query = n1qlQuery.fromString("SELECT LOWER(e1.color) as color, e2.* FROM xxx e1 JOIN xxx e2 ON KEYS e1.person_id WHERE e1.type =\"alert\" AND e1.person_id = \""personId"\"");
      bucket.query(query, function(err, person) {} )

       

      Attachments

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

        Activity

          People

            bingjie.miao Bingjie Miao
            flesik flesik
            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