I'm currently running in some issue with a collection of few hundreds of (heavy) documents.
Some of the fields of the document are pretty heavy, and we're excluding them during the projection stage.
We figure out that the sorting is actually done before the projection, resulting on some memory issues:
Overflow sort stage buffered data usage of 33658319 bytes exceeds internal limit of 33554432 bytes
Here are the questions:
- Is it possible to manually specify the winning plan?
- Is it possible to do the projection before sorting?
- Why is sorting done before projecting?