Collection access paths produced by the query planner.
countScan
(see below). The predicates and details of plan type selection can be seen in the scan
operator in the EXPLAIN output (plan) for a statement.
WHERE field1 = "test filter"
):
WHERE field1 = "test filter" AND field2 > 0
:
IN
filters with a list length to the lower limit of the number of remaining scans or maximum in-list-element directive, may be effected with a union scan.
Example (filter: WHERE field1 = "test filter" OR field2 <= 123
:
SELECT COUNT(*) FROM collection
. It skips reading the collection and accesses the collection count statistic directly. It cannot be forced but can be avoided with the addition of a non-trivial predicate, e.g. WHERE _id IS NOT MISSING
(to not influence the result).
Example:
fetch
operator is used to retrieve full documents based on the document IDs produced earlier in the plan. A collection scan retrieves the documents itself so this step is not necessary.
Example: