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

[N1QL] Secondary index not being used with a particular adhoc query with parameters

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 4.6.3
    • 4.6.3
    • query
    • 4.6.3-4053
    • Untriaged
    • No

    Description

      This bug is found while verifying MB-24871.
      Index created:
      CREATE INDEX `def_name` ON `default`(`name`) WHERE (`job_title` = "Engineer")

      curl command issued:
      curl -v http://Administrator:password@172.23.107.182:8093/query/service -d 'statement=EXPLAIN SELECT * FROM `default` where job_title=$job_title and name=$name&$job_title="Engineer"&$name="id@mail.com"'

      Above command should use def_name as suggested in the examples in MB-24871 but instead it uses primary scan.
      Tried various combinations of back ticks on job_title as suggested by Bingjie but it still uses primary scan.
      Tried the same through cbq, it works.

      Attachments

        Issue Links

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

          Activity

            People

              Prerna.Manaktala Prerna Manaktala (Inactive)
              Prerna.Manaktala Prerna Manaktala (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty