Cost of $sort + $limit should depend on input size

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • ALL
    • QO 2025-02-17
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      # input size = 1 , estimate is 0.00009999999999976694
      var explain = db.foo.find({a:1}).sort({a: 1}).limit(1).hint({$natural: 1}).explain('executionStats');
      explain.executionStats.executionStages.costEstimate - explain.executionStats.executionStages.inputStage.costEstimate;
      
      # input size = 10K, estimate is still 0.00009999999999976694
      var explain = db.foo.find().sort({a: 1}).limit(1).hint({$natural: 1}).explain('executionStats');
      explain.executionStats.executionStages.costEstimate - explain.executionStats.executionStages.inputStage.costEstimate;
      

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

              Created:
              Updated: