TODO-4799: Many index_merge variants made and discarded for a big OR
If a query has many OR-ed constructs which can use multiple indexes (key1=1 AND key2=10) OR (key1=2 AND key2=20) OR (key1=3 AND key2=30) OR ... The range optimizer would construct and then discard a lot of potential index_merge plans. This process 1. is CPU-intensive 2. can hit the @@optimizer_max_sel_args limitation after which all potential range or index_merge plans are discarded. The fix is to apply a heuristic: if there is an OR clause with more than 100 branches, disallow construction of index_merge plans for the OR branches.
Showing
Please register or sign in to comment