You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug#21770798: OPTIMIZER DOES NOT USE INDEX FOR GENERATED EXPRESSIONS
WITH LOGICAL OPERATORS
Before this patch, only expressions with item type ITEM_FUNC were
eligible for substitution with an equivalent generated column. AND and
OR expressions have item type ITEM_COND, and such expressions were
therefore not replaced with a generated column.
For example, a predicate such as (a AND b) = 1 would not be replaced
with gcol = 1, even if there was an indexed generated column gcol
whose generation expression was (a AND b). This meant that some
opportunities for using an index were missed.
This patch enables substitution also for expressions that use AND or
OR.
Since the substitution code works on Item_func objects, and items of
type COND_ITEM already belong to subclasses of Item_func, not much has
to be changed in the substitution logic. The patch mainly loosens up
some type checks to allow both FUNC_ITEM and COND_ITEM to be
substituted. It also adds an override of eq() in Item_cond to make it
possible to check if two logical expressions are equal.
0 commit comments