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

aggregation $count underperforms count()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Works as Designed
    • Affects Version/s: 3.7.3
    • Fix Version/s: None
    • Component/s: Aggregation Framework
    • Labels:
      None
    • Operating System:
      ALL

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: