Combining $comment and .count() degrades performance

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 3.3.2
    • Affects Version/s: None
    • Component/s: Querying
    • Major Change
    • ALL
    • Query 10 (02/22/16)
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When passing a $comment in a query count() doesn't use an index.

      Testcase:

      > for (var i=0; i < 1000000; i++) db.test.insert({a:i})
      > db.test.count()
      1000001
      > db.test.count({$comment:"A"})
      1000001
      > var start = new ISODate(); db.test.count(); new ISODate() - start
      0
      > var start = new ISODate(); db.test.count({$comment:"A"}); new ISODate() - start
      155
      

              Assignee:
              Charlie Swanson
              Reporter:
              Alon Horev
              Votes:
              0 Vote for this issue
              Watchers:
              12 Start watching this issue

                Created:
                Updated:
                Resolved: