• Dave Gosselin's avatar
    MDEV-33971 NAME_CONST in WHERE clause replaced by inner item · 02e38e2e
    Dave Gosselin authored
    Improve performance of queries like
      SELECT * FROM t1 WHERE field = NAME_CONST('a', 4);
    by, in this example, replacing the WHERE clause with field = 4
    in the case of ref access.
    
    The rewrite is done during fix_fields and we disambiguate this
    case from other cases of NAME_CONST by inspecting where we are
    in parsing.  We rely on THD::where to accomplish this.  To
    improve performance there, we change the type of THD::where to
    be an enumeration, so we can avoid string comparisons during
    Item_name_const::fix_fields.  Consequently, this patch also
    changes all usages of THD::where to conform likewise.
    02e38e2e
sql_yacc.yy 594 KB