I have unexpected results comparing the performance of various queries in a collection that I made for testing. The collection somewhat imitates my real needs with 10,000 documents, each with 20 fields (each with 5-30 characters). All documents are the same and only have _id different (maybe this is somehow a problem?).
Unlike the official version of MongoDB, indicating which fields to return do not lead to better performance, but much worse.
A typical find is performed in approximately 5 ms.
db.collection.find().explain()
User find is performed in approximately 30 ms.
db.collection.find({},{Field1:1,Field2:1,Field3:1,Field4:1,Field5:1,Field6:1,Field7:1},{}).explain()
Is the simple query “find everything” and “return everything” faster or am I missing something?
source share