Looking for explanation for query performance on linux between python and c# drivers


Initially I ran into a big performance difference with the C# Mongodb driver running my local windows 11 and with the same data set and code running in a Linux docker image on a Linux box.
This difference could be expected because of the difference in performance on the host

For exploration into the performance I condensed the query code down to python and a compatible c# version and I see that python runs really quick but the c# version is terrible.

Hi, Chris,

Welcome to the MongoDB Community Forums. There are many potential reasons for performance differences between our drivers. One of the most common differences is that in one language you may be retrieving a cursor (which can then be iterated) whereas in another you may be iterating and retrieving the entire result set. Please provide the self-contained C# and Python examples and we will be happy to examine them to help determine the origin of the performance differences. We can then create a CSHARP issue if we verify that there is a performance problem in the .NET/C# Driver.


1 Like

Hi James

Thanks for the response but this post got submitted before I completed it and I couldn’t remove it from pending. I have another post currently in pending with all the details.

full post is here