Cost of SORT-LIMIT(1) should be consistent with SORT-LIMIT(2)

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      Right now there is a big jump between limit 1 and limit 2, even though both operations should take approximately the same amount of resources:

      Enterprise test> var explain = db.foo.find().sort({a:1}).hint({$natural: 1}).limit(1).explain('executionStats');
      Enterprise test> explain.executionStats.executionStages.costEstimate - explain.executionStats.executionStages.inputStage.costEstimate;
      0.00009999999999976694
      
      Enterprise test> var explain = db.foo.find().sort({a:1}).hint({$natural: 1}).limit(2).explain('executionStats');
      Enterprise test> explain.executionStats.executionStages.costEstimate - explain.executionStats.executionStages.inputStage.costEstimate;
      1.0000999999999998
      

            Assignee:
            Unassigned
            Reporter:
            Philip Stoev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: