Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-88949

Explain for classic multi planner displays incorrect skip amount

    • Query Execution
    • Fully Compatible
    • ALL
    • v8.0, v7.3, v7.0, v6.0, v5.0
    • QE 2024-04-29

      db.test.drop();
      for (let i = 0; i < 10; ++i) {
          db.test.insertOne({a: 1, b: 1});
      } db.test.createIndex({a: 1}); db.test.createIndex({b: 1});  // Observe 0 in skipAmount
      print(db.test.find({a: 1, b: 1}).sort({_id: 1}).limit(5).skip(5).explain().queryPlanner.winningPlan);
      
      // Same query with hint (so without multiplanning) will show correct amount
      print(db.test.find({a: 1, b: 1}).sort({_id: 1}).limit(5).skip(5).hint({_id: 1}).explain().queryPlanner.winningPlan); 

            Assignee:
            adi.agrawal@mongodb.com Adi Agrawal
            Reporter:
            ivan.fefer@mongodb.com Ivan Fefer
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: