BUG#20420: optimizer reports wrong keys on left join with IN
The optimizer needs to evaluate whether predicates are better evaluated using an index. IN is one such predicate. To qualify an IN predicate must involve a field of the index on the left and constant arguments on the right. However whether an expression is a constant can be determined only by knowing the preceding tables in the join order. Assuming that only IN predicates with expressions on the right that are constant for the whole query qualify limits the scope of possible optimizations of the IN predicate (more specifically it doesn't allow the "Range checked for each record" optimization for such an IN predicate. Fixed by not pre-determining the optimizability of the IN predicate in the case when all right IN operands are not SQL constant expressions mysql-test/r/func_in.result: BUG#20420: optimizer reports wrong keys on left join with IN - test case mysql-test/t/func_in.test: BUG#20420: optimizer reports wrong keys on left join with IN - test case sql/item_cmpfunc.h: BUG#20420: optimizer reports wrong keys on left join with IN - cannot decide on the optimizability of a function without knowing the tables before it in the join order
Showing
Please register or sign in to comment