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

Use index hint not honored for AND predicates when CBO is on

    XMLWordPrintable

Details

    • Untriaged
    • 0
    • Unknown
    • Analytics CBO Sprint 18

    Description

      This is a fragment of CH2 query 6. This issue is reproducible with similar queries on non-CH2 tables also and happens with both array and non-array indexes.

      SELECT count(*) as revenue
      FROM   orders o, o.o_orderline ol
      WHERE  ol.ol_delivery_d /*+ use-index (orderline_delivery_d) */ >= '2016-01-01 00:00:00.000000'
        AND  ol.ol_delivery_d /*+ use-index (orderline_delivery_d) */ < '2017-01-01 00:00:00.000000';
      

      The hint is honored when there is only a single predicate with no ANDs. The problem happens because the hint is not placed on the AND condition (as it is done for single predicates), but the condition has an "arguments" field which has the annotation. To fix this, we need to check the "arguments" field of the condition for the annotation.

      Attachments

        Issue Links

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

          Activity

            People

              umang.agrawal Umang
              vijay.sarathy Vijay Sarathy
              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