[SERVER-7389] Implement heuristic for evaluating most performant operators first inside $and Created: 17/Oct/12  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Aaron Staple Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 0
Labels: query_triage
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File server7389.js    
Assigned Teams:
Query Execution
Participants:

 Description   

The basic idea is that if the doc is

{ a:0 }

and the query is

{ a:1, $where:... }

then we should reject on the basis of 'a' before evaluating the $where clause (slow).

In the old Matcher, $and checks:

  • simple operators eg equality, $gt, $in
  • then regular expressions
  • then nested compound expressions (nested $and, $or, etc)
  • then $where

We can change the heuristics in the new implementation, but they should stay at least as good as the old ones.


Generated at Thu Feb 08 03:14:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.