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

aggregation $count underperforms count()

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.7.3
    • Component/s: Aggregation Framework
    • Labels:
      None
    • ALL

      i have a collection with 10m rows.

      this returns in like 10ms:

      db.getCollection('people').count()
      

      while this returns like 10s:

      db.getCollection('people').aggregate([{$count: 'count'}])
      

      doesn't seem to be related to https://jira.mongodb.org/browse/SERVER-7568, but similar in marked performance diff doing similar ops in aggregation and non-aggregation styles.

            Assignee:
            william.byrne@mongodb.com William Byrne III
            Reporter:
            tony-kerz tony kerz
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: