-
Type: Improvement
-
Resolution: Unresolved
-
Priority: 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
-
(copied to CRM)
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.
- backports
-
SERVER-80800 Suggestion to improve CountDocuments performance
- Closed
- causes
-
CSHARP-3680 Migrating obsolete "Count" to new methods has a problematic cost
- Closed
-
NODE-1638 countDocuments is slower then count
- Closed
- is depended on by
-
SERVER-25898 Make the count command always execute as an aggregation pipeline
- Backlog
- related to
-
SERVER-69257 COUNT_SCAN plan not selected when unfiltered $group + $sum on _id performed
- Needs Scheduling
-
SERVER-84948 Investigate agg performance compared to count command
- Closed
-
SERVER-29444 Use a covered and streaming plan for $group, $sum:1 queries
- Needs Scheduling