Incorrect predicates push down to IndexScan

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 8.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization
    • Fully Compatible
    • ALL
    • Hide
      db.coll.drop();
      db.coll.createIndex({a:1, b:1});
      const docs = [{a:11, b: 2}, {a: 11, b: null}, {a: 11}];
      db.coll.insertMany(docs);
      db.coll.find({b: {$exists: true}}).sort({a: 1});
      

      8.0 returns expected results

      [
        { _id: ObjectId('687623b67d7387eb9832a03d'), a: 11, b: null },
        { _id: ObjectId('687623b67d7387eb9832a03c'), a: 11, b: 2 }
      ]
      

      current master returns incorrect results

        { _id: ObjectId('687623e9a5cd1feb4ab05270'), a: 11, b: null },
        { _id: ObjectId('687623e9a5cd1feb4ab05271'), a: 11 },
        { _id: ObjectId('687623e9a5cd1feb4ab0526f'), a: 11, b: 2 }
      
      Show
      db.coll.drop(); db.coll.createIndex({a:1, b:1}); const docs = [{a:11, b: 2}, {a: 11, b: null }, {a: 11}]; db.coll.insertMany(docs); db.coll.find({b: {$exists: true }}).sort({a: 1}); 8.0 returns expected results [ { _id: ObjectId( '687623b67d7387eb9832a03d' ), a: 11, b: null }, { _id: ObjectId( '687623b67d7387eb9832a03c' ), a: 11, b: 2 } ] current master returns incorrect results { _id: ObjectId( '687623e9a5cd1feb4ab05270' ), a: 11, b: null }, { _id: ObjectId( '687623e9a5cd1feb4ab05271' ), a: 11 }, { _id: ObjectId( '687623e9a5cd1feb4ab0526f' ), a: 11, b: 2 }
    • 200
    • None
    • 3
    • TBD
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      SERVER-103601 introduces additional predicates push down to IndexScan, unfortunately due to a known bug with the indexes not being able to distinguish between missing and null values. this push down does not always work correctly.

              Assignee:
              Ruoxin Xu
              Reporter:
              Alexander Ignatyev
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: