SERVER-121078Open

Join optimization: non-join-optimization-enabled NLJ execution may win against HJ in the case of $limit

In the case of a small $limit, the non-join-optimized execution can terminate the processing of the entire query immediately once the $limit is reached. However, if join optimization elects to build any hash tables, those tables need to be built in their entirety, incurring a fixed cost regardless of the $limit. To reproduce, run the following query against the tpch 0.1 dataset: {code:java} {">>>command": {"aggregate":"lineitem","pipeline":[{"$lookup":{"from":"orders","localField":"l_order

Affected Versions
Versions known to exhibit this issue

No affected versions recorded.

Fixed Versions
Versions that include the fix

No fix available yet.

Components
Server components related to this issue

No components specified.

Labels
Tags and classification
M5join-limit