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

Performance of count() on range check queries is worse than it should be

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • 1.6.5
    • None
    • Querying
    • None
    • Any

    Description

      Using the test script below this script reports about 50ms of time taken for the count query in the script. This is way too slow for a query that the query optimizer should resolve to a direct bsearch on the index, or so I assume.

      use test

      db.values.drop();
      db.values.ensureIndex(

      {value:1}

      );

      for (var i = 1; i <= 100000; i++) db.values.save(

      {value : i}

      );

      var t1 = new Date().getTime();
      db.values.count({value:{$gt:5000}});
      var t2 = new Date().getTime();

      (t2 - t1);

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              remonvv Remon van Vliet
              Votes:
              57 Vote for this issue
              Watchers:
              35 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: