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

N1QL plan analyzer cannot select an index if a list is given in parameters

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Major
    • 4.6.3, 5.0.0
    • 4.5.0, 4.5.1
    • query
    • None
    • OS: CentOS 7, Linux Kernel 3.10.0-514.6.1.el7.x86_64
      DB: Couchbase Server 4.5.1-2844 (CE) and Couchbase Server 4.5.0-2601 (CE)
      libcouchbase: libcouchbase2-core.x86_64 2.7.6 1.el7.centos
      couchbase-python-client: 2.2.2
      Python: 2.7.5
    • Untriaged
    • Centos 64-bit
    • No

    Description

      Problem:

      When using a list parameter value for N1QL query with IN statement - it fails to properly build an index scan.  As a result performance is hit dramatically for large data sets.

      This issue is not observed if using a hand-made query where a list parameter was inserted manually.

      Steps to Reproduce:

      1. Install travel-sample bucket.
      2. Run attached screen.
      3. Compare Explain output and timing.

      Expected Result:

      Both queries (with parameters and without parameters) are semantically the same, hence both explain and time to run a query should be the same.

      Actual Result:

      A plan analyzer fails to properly build an index scan for a parametrized query.
      As result a time to run it is much higher: it's 2s vs 300ms for a travel-sample; in our real-world scenario with 1M records it is like 2 minutes vs 2-3 seconds.

      Attachments

        1. test.py
          2 kB
        2. test.txt
          7 kB

        Issue Links

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

          Activity

            People

              keshav Keshav Murthy
              volodymyr.khoroz Volodymyr Khoroz
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty