-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
-
Fully Compatible
-
QE 2023-08-07, QE 2023-08-21, QE 2023-09-04, QE 2023-09-18, QE 2023-10-02
-
35
For large $match queries of the form {$match: {a: 1, b: 1, ... }}, we have quadratic time behavior on the number of predicates in two places during compilation: #1 #2
The issue is in appending the code fragments for each clause. LHS appends "code", resizing the LHS vector. Then we assign LHS to "code", and get the next LHS. This LHS appends the new code, resizing once again, but to a larger size. The number of allocations is about the same as the number of clauses, but each allocation will be the size of the code we have so far. This results in an n^2 behavior on the number of clauses.
For the largest $match I can possibly make, compiling takes 30+ minutes. With a proof of concept to only append to one code fragment and allow a single vector to resize in the expected way (doubling each time), it takes a minute or less.
- depends on
-
SERVER-80970 Improve perf for SBE local variables with 'moveFrom=true'
- Closed
- is related to
-
SERVER-71352 Investigate using linear builder-style compilation of EExpression
- Open
- related to
-
SERVER-62509 Write tests to stress ABT and Bonsai
- Closed