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

Composite index with count scan returns wrong results

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Blocker
    • 4.5.0
    • 4.5.0
    • query
    • 4.5.0-1897
    • Untriaged
    • Yes

    Description

      A simple test repro gives wrong results:

      insert into default values("k01",

      {"f1":1, "f2":true}

      );
      insert into default values("k02",

      {"f1":2, "f2":false}

      );
      insert into default values("k03",

      {"f1":3, "f2":true}

      );
      insert into default values("k04",

      {"f1":4, "f2":false}

      );
      insert into default values("k05",

      {"f1":5, "f2":true}

      );
      create index ix1 on default(f1,f2);

      select count(1) from default where f1 < 3 and f2 = true;
      Above query returns 2 rows.
      Also
      select count from default where f1 < 3 and f2 = true;
      returns 2 rows.
      Because both use count scan.

      But
      select count(f1) from default where f1 < 3 and f2 = true;
      returns 1 row because it doesnt use the count scan.

      Please try other combinations.
      Also uploading the test case which failed for rqg.

      Attachments

        1. bucket.tar
          340 kB
        2. log.zip
          18.59 MB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Sitaram.Vemulapalli Sitaram Vemulapalli
            Prerna.Manaktala Prerna Manaktala (Inactive)
            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