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

16% performance loss switching from Count to CountDocuments

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.4.5, 4.0.25
    • Component/s: None
    • Query Optimization
    • QO 2022-04-04, QO 2022-04-18, QO 2022-05-02, QO 2022-05-16, QO 2022-05-30, QO 2022-06-13, QO 2022-06-27, QO 2022-07-11, QO 2022-07-25, QO 2022-08-08, QO 2022-08-22, QO 2022-09-05, QO 2022-09-19, QO 2022-10-03, QE 2022-10-17

      Dear Server team,

      I'm a C# dev on a team using MongoDb and I have the task to clean up the compile warnings. One warning was "Count is obsolete. Use CountDocuments instead"

      But at every occurrence in the code,  at all the lines have the comment "Don't use CountDocuments, it is slower", referencing Jira NODE-1638.

      I did my own tests and indeed found CountDocuments to be about 34% slower then Count (~150 ms longer). That is quite significant and thus a problem for us, as we are already having performance issues.

      First thinking this was a C# driver issue, I opened a ticket CSHARP-3680 and had some interaction there. However, we found out that the issue already occurs on the server, thus should get a new SERVER ticket.

      Please read CSHARP-3680 for all the details and let me know what more information you need.

      Thank you.

            Assignee:
            Unassigned Unassigned
            Reporter:
            jochem@netwinst.nl Jochem Bonarius
            Votes:
            4 Vote for this issue
            Watchers:
            31 Start watching this issue

              Created:
              Updated: