Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is a collection scan in mongodb?

I'm aware what a "full collection scan" is. But i'm a little unsure if the term "collection scan" applies to queries that use B-tree cursor. Do queries that use a cursor other than the basic cursor perform a collection scan?

like image 866
n3wb Avatar asked Feb 13 '23 20:02

n3wb


1 Answers

The short answer is the two terms are the same, or rather there is only "full collection scan".

If your query is using a B-tree cursor it is by definition not scanning the collection put is traversing the index in order to find the queried documents.

A collection scan occurs where no index can satisfy the query and we have to scan the full collection in order to find the required documents. See the link for all the information.

http://docs.mongodb.org/manual/reference/method/cursor.explain/

like image 162
Neil Lunn Avatar answered Feb 18 '23 22:02

Neil Lunn