[SERVER-65049] Optimize away { $expr : true } in $match clauses Created: 29/Mar/22 Updated: 29/Oct/23 Resolved: 18/Aug/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 5.0.6 |
| Fix Version/s: | 6.1.0-rc0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | James Kovacs | Assignee: | Henri Nikku |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | neweng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||
| Participants: | |||||||||||||||||
| Linked BF Score: | 161 | ||||||||||||||||
| Description |
|
{ $expr : true }
is equivalent to { }, but the two generate different query plans (see below). The .NET/C# driver will generate { $expr : true }if all variables are known at run-time on the client-side and evaluate to true. (Other query frameworks that generate MQL dynamically will likely do something similar.) The .NET/C# driver is implementing a client-side optimization to render { $expr : true }as { } in $match clauses, but older versions (and other drivers) won't have this optimization. It is desirable for the query engine to implement this optimization itself. Note that this is similar to SERVER-33925, which considers the case of { $expr : false }. Query plans...
|
| Comments |
| Comment by Githook User [ 26/Jul/22 ] |
|
Author: {'name': 'Uladzimir Makouski', 'email': 'uladzimir.makouski@mongodb.com', 'username': 'umakouski'}Message: Revert " in $match clauses" This reverts commit 3b51f4acaa6a57e8ced17971f85c7d6d35ac0cca. |
| Comment by Githook User [ 25/Jul/22 ] |
|
Author: {'name': 'Henri Nikku', 'email': 'henri.nikku@mongodb.com', 'username': 'henrinikku'}Message: in $match clauses |