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

[BP to 7.1.5/7.2.1 MB-56775] UNNEST shouldn't cover via implicit when projected unnest expression

    XMLWordPrintable

Details

    • Untriaged
    • 0
    • Yes

    Description

      UPSERT INTO default VALUES ("f01",{"a1":[ {"f1":1}, {"f1":1}]});
       
      CREATE INDEX ix30 ON default (ALL ARRAY v1.f1 FOR v1 IN a1 END);
      SELECT d.a1
      FROM default AS d
      UNNEST d.a1 AS v1
      WHERE v1.f1 = 1;
      

      Above query should not cover using implicit array index because it projecting d.a1

      This may be regression of MB-32506

      https://github.com/couchbase/query/blob/master/planner/build_scan_unnest_cov.go#L115
      We should remove this and check here if present ihttps://github.com/couchbase/query/blob/master/planner/build_scan_unnest_cov.go#L129 like 6.x

       

      Issue Resolution
      Under certain circumstances, a query with UNNEST used a covering index scan and incorrect results were returned. Reference to the UNNEST expression should have prevented the covering index from being used for the query as the index did not contain the entire array. The logic to determine covering UNNEST scans has been changed to not use a covering index scan for such queries.

      Attachments

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

        Activity

          People

            pierre.regazzoni Pierre Regazzoni
            Sitaram.Vemulapalli Sitaram Vemulapalli
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty