1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-05 13:16:09 +03:00

MDEV-36106 New-style hints: [NO_]DERIVED_CONDITION_PUSHDOWN, [NO_]MERGE

Implements and tests the optimizer hints DERIVED_CONDITION_PUSHDOWN
and NO_DERIVED_CONDITION_PUSHDOWN, table-level hints to enable and
disable, respectively, the condition pushdown for derived tables
which is typically controlled by the condition_pushdown_for_derived
optimizer switch.

Implements and tests the optimizer hints MERGE and NO_MERGE, table-level
hints to enable and disable, respectively, the derived_merge optimization
which is typically controlled by the derived_merge optimizer switch.

Sometimes hints need to be fixed before TABLE instances are available, but
after TABLE_LIST instances have been created (as in the cases of MERGE and
NO_MERGE).  This commit introduces a new function called
fix_hints_for_derived_table to allow early hint fixing for derived tables,
using only a TABLE_LIST instance (so long as such hints are not index-level).
This commit is contained in:
Dave Gosselin
2025-02-24 11:32:27 -05:00
committed by Dave Gosselin
parent e653666368
commit 2ee2e2d0f3
10 changed files with 3367 additions and 41 deletions

View File

@@ -71,6 +71,10 @@ Optimizer_hint_tokenizer::find_keyword(const LEX_CSTRING &str)
if ("MRR"_Lex_ident_column.streq(str)) return TokenID::keyword_MRR;
break;
case 5:
if ("MERGE"_Lex_ident_column.streq(str)) return TokenID::keyword_MERGE;
break;
case 6:
if ("NO_BKA"_Lex_ident_column.streq(str)) return TokenID::keyword_NO_BKA;
if ("NO_BNL"_Lex_ident_column.streq(str)) return TokenID::keyword_NO_BNL;
@@ -88,6 +92,8 @@ Optimizer_hint_tokenizer::find_keyword(const LEX_CSTRING &str)
return TokenID::keyword_SEMIJOIN;
else if ("SUBQUERY"_Lex_ident_column.streq(str))
return TokenID::keyword_SUBQUERY;
else if ("NO_MERGE"_Lex_ident_column.streq(str))
return TokenID::keyword_NO_MERGE;
break;
case 9:
@@ -134,6 +140,16 @@ Optimizer_hint_tokenizer::find_keyword(const LEX_CSTRING &str)
if ("NO_RANGE_OPTIMIZATION"_Lex_ident_column.streq(str))
return TokenID::keyword_NO_RANGE_OPTIMIZATION;
break;
case 26:
if ("DERIVED_CONDITION_PUSHDOWN"_Lex_ident_column.streq(str))
return TokenID::keyword_DERIVED_CONDITION_PUSHDOWN;
break;
case 29:
if ("NO_DERIVED_CONDITION_PUSHDOWN"_Lex_ident_column.streq(str))
return TokenID::keyword_NO_DERIVED_CONDITION_PUSHDOWN;
break;
}
if (str.length > 0 && (str.str[0] >= '0' && str.str[0] <= '9'))
@@ -325,6 +341,22 @@ bool Parser::Table_level_hint::resolve(Parse_context *pc) const
hint_type= BKA_HINT_ENUM;
hint_state= false;
break;
case TokenID::keyword_DERIVED_CONDITION_PUSHDOWN:
hint_type= DERIVED_CONDITION_PUSHDOWN_HINT_ENUM;
hint_state= true;
break;
case TokenID::keyword_NO_DERIVED_CONDITION_PUSHDOWN:
hint_type= DERIVED_CONDITION_PUSHDOWN_HINT_ENUM;
hint_state= false;
break;
case TokenID::keyword_MERGE:
hint_type= MERGE_HINT_ENUM;
hint_state= true;
break;
case TokenID::keyword_NO_MERGE:
hint_type= MERGE_HINT_ENUM;
hint_state= false;
break;
default:
DBUG_ASSERT(0);
return true;