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

[n1ql] Results are different in query using covered Intersectscan of array index and primary scan

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 4.6.2, 5.0.0
    • 4.6.2, 5.0.0
    • query
    • 4.6.2-3889
    • Untriaged
    • Yes

    Description

      Found this issue while verifying:
      https://issues.couchbase.com/browse/MB-22757

      Index created:
      CREATE INDEX idx ON default( DISTINCT ARRAY v FOR v in join_yr END)

      Query issued:
      EXPLAIN select meta().id from default where any v in join_yr satisfies v = 2016 END and (ANY v IN default.join_yr SATISFIES v = 2014 END)

      This query uses the right index and is a covered query as expected in MB-22757.
      But it gives different results than the same query using primary index.

      select meta().id from default where any v in join_yr satisfies v = 2016 END and (ANY v IN default.join_yr SATISFIES v = 2014 END) order by meta().id limit 2

      gives different results than

      select meta().id from default use index (`#primary`) where any v in join_yr satisfies v = 2016 END and (ANY v IN default.join_yr SATISFIES v = 2014 END) order by meta().id limit 2

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                PagerDuty