I understand what a COLLSCAN
is in MongoDB query plan - there is no index available so Mongo must scan the entire collection.
Obviously this will cause longer execution times for the query in question, but what I'm wondering about is if it causes any other things to happen that could affect performance? Increased memory usage? Could it push other data that needs to be in memory out of memory while it's scanning the whole table?
I found mention of COLLSCAN
on this MongoDB documentation page, but it doesn't go into much detail about what happens or possible consequences. Can anyone explain (or point me to a resource that does) what other problems could potentially occur do to a COLLSCAN
?
On busy systems this will affect performance, as data need to be read from disk, allocated in page (memory) - which at the could activate swapping process.
Depending on amount of system memory and disk performance - this will be not a case when it could be cached or reads will not be blocking other I/O operations.
If COLLSCAN occurs on application primary collection - other data will be freed or pushed to swap if no RAM available.
COLLSCAN could occur on indexed field during aggregation framework pipeline execution - when pipeline request cannot use indexes at execution phase.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With