Working with huge datasets - optimizing aggregates with date fields

Your query is equivalent to

May be, just may be, the fact that you are using the explicit $and rather than the implicit version above causes the optimizer to ignore the index.

Share your indices and the explain plan for further help.

2 Likes