28#ifndef OPT_HINTS_INCLUDED 
   29#define OPT_HINTS_INCLUDED 
  129    if (switch_state_arg)
 
  398               uint select_number_arg);
 
  483      bool toplevel = 
false);
 
  579      : 
Opt_hints(table_name_arg, qb_hints_arg, mem_root_arg),
 
  650                             Key_map *available_keys_to_use,
 
  663      : 
Opt_hints(key_name_arg, table_hints_arg, mem_root_arg) {}
 
  717               Item *sys_var_value);
 
  811                          bool *use_cheapest_index_merge);
 
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:247
 
Definition: sql_bitmap.h:154
 
bool is_set(uint n) const
Definition: sql_bitmap.h:186
 
void set_bit(uint n)
Definition: sql_bitmap.h:165
 
bool is_clear_all() const
Definition: sql_bitmap.h:197
 
void init()
Definition: sql_bitmap.h:162
 
void clear_bit(uint n)
Definition: sql_bitmap.h:169
 
Auxiliary class for compound key objects.
Definition: opt_hints.h:513
 
void set_key_map(uint i)
Definition: opt_hints.h:533
 
PT_key_level_hint * pt_hint
Definition: opt_hints.h:514
 
void set_pt_hint(PT_key_level_hint *pt_hint_arg)
Definition: opt_hints.h:527
 
Key_map key_map
Definition: opt_hints.h:515
 
virtual ~Compound_key_hint()=default
 
void set_resolved(bool arg)
Definition: opt_hints.h:530
 
Compound_key_hint()
Definition: opt_hints.h:519
 
bool resolved
Definition: opt_hints.h:516
 
bool is_resolved()
Definition: opt_hints.h:531
 
bool is_set_key_map(uint i)
Definition: opt_hints.h:534
 
Key_map * get_key_map()
Definition: opt_hints.h:536
 
bool is_key_map_clear_all()
Definition: opt_hints.h:535
 
virtual bool is_hint_conflicting(Opt_hints_table *table_hint, Opt_hints_key *key_hint)
Definition: opt_hints.h:537
 
PT_key_level_hint * get_pt_hint()
Definition: opt_hints.h:528
 
Auxiliary class for INDEX hint.
Definition: opt_hints.h:555
 
bool is_hint_conflicting(Opt_hints_table *table_hint, Opt_hints_key *key_hint) override
Function checks if INDEX hint is conflicting with already specified JOIN_INDEX, GROUP_INDEX,...
Definition: opt_hints.cc:1239
 
Container for set_var object and original variable value.
Definition: opt_hints.h:689
 
Item * save_value
Definition: opt_hints.h:693
 
Hint_set_var(set_var *var_arg)
Definition: opt_hints.h:691
 
set_var * var
Definition: opt_hints.h:692
 
Auxiliary class for JOIN_INDEX, GROUP_INDEX, ORDER_INDEX hints.
Definition: opt_hints.h:546
 
bool is_hint_conflicting(Opt_hints_table *table_hint, Opt_hints_key *key_hint) override
Function checks if JOIN_INDEX|GROUP_INDEX|ORDER_INDEX hint is conflicting with already specified INDE...
Definition: opt_hints.cc:1256
 
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:928
 
Definition: sql_optimizer.h:133
 
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:432
 
Global level hints.
Definition: opt_hints.h:352
 
void append_name(const THD *, String *) override
Definition: opt_hints.h:367
 
PT_hint * get_complex_hints(opt_hints_enum type) override
Returns pointer to complex hint for a given type.
Definition: opt_hints.cc:192
 
Opt_hints_global(MEM_ROOT *mem_root_arg)
Definition: opt_hints.h:359
 
Sys_var_hint * sys_var_hint
Definition: opt_hints.h:355
 
bool deferred_hints_flag
Definition: opt_hints.h:357
 
void print_irregular_hints(const THD *thd, String *str) override
Function prints hints which are non-standard and don't fit into existing hint infrastructure.
Definition: opt_hints.cc:199
 
PT_hint_list * deferred_hints
Definition: opt_hints.h:356
 
PT_hint_max_execution_time * max_exec_time
Definition: opt_hints.h:354
 
Key level hints.
Definition: opt_hints.h:659
 
void append_name(const THD *thd, String *str) override
Append key name.
Definition: opt_hints.h:671
 
bool ignore_print(opt_hints_enum type_arg) const override
Ignore printing of the object since parent complex hint has its own printing method.
Definition: opt_hints.h:680
 
Opt_hints_key(const LEX_CSTRING *key_name_arg, Opt_hints_table *table_hints_arg, MEM_ROOT *mem_root_arg)
Definition: opt_hints.h:661
 
Opt_hints_map contains information about hint state(specified or not, hint value).
Definition: opt_hints.h:108
 
bool switch_on(opt_hints_enum type_arg) const
Get switch value.
Definition: opt_hints.h:142
 
bool is_specified(opt_hints_enum type_arg) const
Check if hint is specified.
Definition: opt_hints.h:119
 
void set_switch(opt_hints_enum type_arg, bool switch_state_arg)
Set switch value and set hint into specified state.
Definition: opt_hints.h:128
 
Bitmap< 64 > hints_specified
Definition: opt_hints.h:110
 
Bitmap< 64 > hints
Definition: opt_hints.h:109
 
Query block level hints.
Definition: opt_hints.h:378
 
bool has_join_order_hints() const
Checks if any join order hints have been specified in query.
Definition: opt_hints.cc:524
 
bool check_join_order_hints(RelationalExpression *left, RelationalExpression *right, const mem_root_deque< Table_ref * > *join_list)
Checks if a combination of left and right RelationalExpressions satisfy one or more join order hints.
Definition: opt_hints.cc:894
 
void print_irregular_hints(const THD *thd, String *str) override
Function prints hints which are non-standard and don't fit into existing hint infrastructure.
Definition: opt_hints.cc:277
 
void register_join_order_hint(PT_qb_level_hint *hint_arg)
Definition: opt_hints.h:503
 
Opt_hints_table * adjust_table_hints(Table_ref *table)
Function finds Opt_hints_table object corresponding to table alias in the query block and attaches co...
Definition: opt_hints.cc:225
 
PT_qb_level_hint * semijoin_hint
Definition: opt_hints.h:383
 
uint select_number
Definition: opt_hints.h:379
 
Subquery_strategy subquery_strategy() const
Returns which subquery execution strategy has been specified by hints for this query block.
Definition: opt_hints.cc:270
 
ulonglong join_order_hints_ignored
Bit map of which hints are ignored.
Definition: opt_hints.h:388
 
void clear_join_order_hints()
Deletes all the join order hints.
Definition: opt_hints.cc:531
 
void apply_join_order_hints(JOIN *join)
Checks if join order hints are applicable and applies table dependencies if possible.
Definition: opt_hints.cc:1061
 
PT_qb_level_hint * subquery_hint
Definition: opt_hints.h:383
 
Opt_hints_qb(Opt_hints *opt_hints_arg, MEM_ROOT *mem_root_arg, uint select_number_arg)
Definition: opt_hints.cc:203
 
LEX_CSTRING sys_name
Definition: opt_hints.h:380
 
uint sj_enabled_strategies(uint opt_switches) const
Returns bit mask of which semi-join strategies are enabled for this query block.
Definition: opt_hints.cc:256
 
void append_name(const THD *thd, String *str) override
Append query block name.
Definition: opt_hints.h:424
 
PT_hint * get_complex_hints(opt_hints_enum type) override
Returns pointer to complex hint for a given type.
Definition: opt_hints.cc:216
 
char buff[32]
Definition: opt_hints.h:381
 
bool semijoin_enabled(const THD *thd) const
Returns whether semi-join is enabled for this query block.
Definition: opt_hints.cc:239
 
const mem_root_deque< Table_ref * > * sort_tables_in_join_order(THD *thd, const mem_root_deque< Table_ref * > &join_list, bool toplevel=false)
Sorts tables from the join list to create a new join list which contains the tables in an order which...
Definition: opt_hints.cc:627
 
const LEX_CSTRING * get_print_name() override
Definition: opt_hints.h:400
 
void append_qb_hint(const THD *thd, String *str)
Append query block hint.
Definition: opt_hints.h:411
 
bool hinted_join_order(PT_qb_level_hint *hint, RelationalExpression *left, RelationalExpression *right, const mem_root_deque< Table_ref * > *join_list)
Checks if a combination of left and right RelationalExpressions satisfy a hint.
Definition: opt_hints.cc:921
 
Mem_root_array< PT_qb_level_hint * > join_order_hints
Array of join order hints.
Definition: opt_hints.h:386
 
Table level hints.
Definition: opt_hints.h:567
 
Compound_key_hint skip_scan
Definition: opt_hints.h:571
 
Index_key_hint group_index
Definition: opt_hints.h:574
 
void set_resolved() override
Definition: opt_hints.h:601
 
Index_key_hint join_index
Definition: opt_hints.h:573
 
bool is_hint_conflicting(Opt_hints_key *key_hint, opt_hints_enum type)
Definition: opt_hints.cc:1129
 
void append_name(const THD *thd, String *str) override
Append table name.
Definition: opt_hints.h:588
 
Glob_index_key_hint index
Definition: opt_hints.h:572
 
void update_index_hint_map(Key_map *keys_to_use, Key_map *available_keys_to_use, opt_hints_enum type_arg)
Function updates key_to_use key map depending on index hint state.
Definition: opt_hints.cc:1143
 
bool is_resolved(opt_hints_enum type_arg) override
Returns 'resolved' flag value for depending on hint type.
Definition: opt_hints.h:616
 
void set_unresolved(opt_hints_enum type_arg) override
Set hint to unresolved state.
Definition: opt_hints.h:611
 
bool update_index_hint_maps(THD *thd, TABLE *tbl)
Function updates keys_in_use_for_query, keys_in_use_for_group_by, keys_in_use_for_order_by depending ...
Definition: opt_hints.cc:1185
 
Compound_key_hint * get_compound_key_hint(opt_hints_enum type_arg)
Definition: opt_hints.h:632
 
void set_compound_key_hint_map(Opt_hints *hint, uint arg)
Definition: opt_hints.h:623
 
Mem_root_array< Opt_hints_key * > keyinfo_array
Definition: opt_hints.h:569
 
Opt_hints_table(const LEX_CSTRING *table_name_arg, Opt_hints_qb *qb_hints_arg, MEM_ROOT *mem_root_arg)
Definition: opt_hints.h:577
 
void adjust_key_hints(Table_ref *table)
Function sets correlation between key hint objects and appropriate KEY structures.
Definition: opt_hints.cc:1071
 
PT_hint * get_complex_hints(opt_hints_enum type) override
Returns pointer to complex hint for a given type.
Definition: opt_hints.cc:1124
 
Compound_key_hint index_merge
Definition: opt_hints.h:570
 
bool is_force_index_hint(opt_hints_enum type_arg)
Definition: opt_hints.h:643
 
Index_key_hint order_index
Definition: opt_hints.h:575
 
Opt_hints class is used as ancestor for Opt_hints_global, Opt_hints_qb, Opt_hints_table,...
Definition: opt_hints.h:164
 
bool get_switch(opt_hints_enum type_arg) const
Function returns switch hint state.
Definition: opt_hints.cc:116
 
virtual ~Opt_hints()=default
 
void append_hint_type(String *str, opt_hints_enum type)
Append hint type.
Definition: opt_hints.cc:160
 
Mem_root_array< Opt_hints * > * child_array_ptr()
Definition: opt_hints.h:271
 
Opt_hints_map hints_map
Definition: opt_hints.h:181
 
bool is_all_resolved() const
Definition: opt_hints.h:273
 
virtual void set_resolved()
Definition: opt_hints.h:239
 
virtual void append_name(const THD *thd, String *str)=0
 
virtual void set_unresolved(opt_hints_enum type_arg)
Set hint to unresolved state.
Definition: opt_hints.h:255
 
virtual const LEX_CSTRING * get_name() const
Definition: opt_hints.h:235
 
virtual bool is_resolved(opt_hints_enum type_arg)
Returns 'resolved' flag value for depending on hint type.
Definition: opt_hints.h:247
 
Opt_hints(const LEX_CSTRING *name_arg, Opt_hints *parent_arg, MEM_ROOT *mem_root_arg)
Definition: opt_hints.h:191
 
bool resolved
Definition: opt_hints.h:186
 
virtual const LEX_CSTRING * get_print_name()
Definition: opt_hints.h:236
 
virtual PT_hint * get_complex_hints(opt_hints_enum type)
Returns pointer to complex hint for a given type.
Definition: opt_hints.h:289
 
void print(const THD *thd, String *str, enum_query_type query_type)
Print all hints except of QB_NAME hint.
Definition: opt_hints.cc:134
 
void incr_resolved_children()
Definition: opt_hints.h:270
 
Opt_hints * parent
Definition: opt_hints.h:179
 
bool set_switch(bool switch_state_arg, opt_hints_enum type_arg, bool check_parent)
Function sets switch hint state.
Definition: opt_hints.h:215
 
void register_child(Opt_hints *hint_arg)
Definition: opt_hints.h:277
 
uint resolved_children
Definition: opt_hints.h:188
 
void print_warn_unresolved(THD *thd)
Print warning for unresolved hint name.
Definition: opt_hints.cc:166
 
const LEX_CSTRING * name
Definition: opt_hints.h:172
 
Opt_hints * find_by_name(const LEX_CSTRING *name_arg, const CHARSET_INFO *cs) const
Find hint among lower-level hint objects.
Definition: opt_hints.cc:125
 
virtual void print_irregular_hints(const THD *thd, String *str)
Function prints hints which are non-standard and don't fit into existing hint infrastructure.
Definition: opt_hints.h:344
 
bool is_specified(opt_hints_enum type_arg) const
Definition: opt_hints.h:201
 
void check_unresolved(THD *thd)
Check if there are any unresolved hint objects and print warnings for them.
Definition: opt_hints.cc:183
 
Mem_root_array< Opt_hints * > child_array
Definition: opt_hints.h:184
 
void set_name(const LEX_CSTRING *name_arg)
Definition: opt_hints.h:237
 
virtual bool ignore_print(opt_hints_enum type_arg) const
If ignore_print() returns true, hint is not printed in Opt_hints::print() function.
Definition: opt_hints.h:267
 
Opt_hints * get_parent() const
Definition: opt_hints.h:238
 
Definition: parse_tree_hints.h:100
 
Parse tree hint object for MAX_EXECUTION_TIME hint.
Definition: parse_tree_hints.h:270
 
The class is a base class for representation of the different types of the hints.
Definition: parse_tree_hints.h:58
 
Parse tree hint object for key level hints.
Definition: parse_tree_hints.h:210
 
Parse tree hint object for query block level hints.
Definition: parse_tree_hints.h:127
 
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:169
 
SET_VAR hints.
Definition: opt_hints.h:700
 
Mem_root_array< Hint_set_var * > var_list
Definition: opt_hints.h:702
 
bool add_var(THD *thd, const System_variable_tracker &var_tracker, Item *sys_var_value)
Add variable to hint list.
Definition: opt_hints.cc:1300
 
void restore_vars(THD *thd)
Restore system variables with original values.
Definition: opt_hints.cc:1356
 
void print(const THD *thd, String *str)
Print applicable hints.
Definition: opt_hints.cc:1382
 
void update_vars(THD *thd)
Find variable in hint list.
Definition: opt_hints.cc:1333
 
Sys_var_hint(MEM_ROOT *mem_root_arg)
Definition: opt_hints.h:705
 
Wrapper interface for all kinds of system variables.
Definition: set_var.h:580
 
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
 
A (partial) implementation of std::deque allocating its blocks on a MEM_ROOT.
Definition: mem_root_deque.h:111
 
set_var_base descendant for assignments to the system variables.
Definition: set_var.h:983
 
A class representing one system variable - that is something that can be accessed as @global....
Definition: set_var.h:107
 
enum_query_type
Query type constants (usable as bitmap flags).
Definition: enum_query_type.h:31
 
Subquery_strategy
Classes that represent predicates over table subqueries: [NOT] EXISTS, [NOT] IN, ANY/SOME and ALL.
Definition: item_subselect.h:438
 
A better implementation of the UNIX ctype(3) library.
 
Header for compiler-dependent features.
 
Some integer typedefs for easier portability.
 
unsigned long long int ulonglong
Definition: my_inttypes.h:56
 
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1078
 
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
 
Definition: commit_order_queue.h:34
 
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
 
void right(std::string *to_trim)
Definition: trim.h:41
 
void left(std::string *to_trim)
Definition: trim.h:35
 
void append_identifier(std::string *sbuf, std::string_view id, String *bufp)
Append an identifier to a string using backtick quotes.
Definition: utils.cc:36
 
std::string join(const detail::range auto &rng, std::string_view delim)
join elements of a range into a string separated by a delimiter.
Definition: string.h:74
 
const char * table_name
Definition: rules_table_service.cc:56
 
bool is_compound_hint(opt_hints_enum type_arg)
Definition: opt_hints.cc:1117
 
bool hint_table_state(const THD *thd, const Table_ref *table, opt_hints_enum type_arg, uint optimizer_switch)
Returns table hint value if hint is specified, returns optimizer switch value if hint is not specifie...
Definition: opt_hints.cc:1452
 
bool compound_hint_key_enabled(const TABLE *table, uint keyno, opt_hints_enum type_arg)
Returns true if compound hint state is on with or without specified keys, otherwise returns false.
Definition: opt_hints.cc:1476
 
bool idx_merge_hint_state(THD *thd, const TABLE *table, bool *use_cheapest_index_merge)
Returns true if index merge hint state is on otherwise returns false.
Definition: opt_hints.cc:1494
 
opt_hints_enum
Hint types, MAX_HINT_ENUM should be always last.
Definition: opt_hints.h:66
 
@ JOIN_PREFIX_HINT_ENUM
Definition: opt_hints.h:77
 
@ INDEX_MERGE_HINT_ENUM
Definition: opt_hints.h:81
 
@ DERIVED_MERGE_HINT_ENUM
Definition: opt_hints.h:76
 
@ MAX_HINT_ENUM
Definition: opt_hints.h:90
 
@ BNL_HINT_ENUM
Definition: opt_hints.h:68
 
@ ORDER_INDEX_HINT_ENUM
Definition: opt_hints.h:88
 
@ JOIN_SUFFIX_HINT_ENUM
Definition: opt_hints.h:78
 
@ DERIVED_CONDITION_PUSHDOWN_HINT_ENUM
Definition: opt_hints.h:89
 
@ RESOURCE_GROUP_HINT_ENUM
Definition: opt_hints.h:82
 
@ GROUP_INDEX_HINT_ENUM
Definition: opt_hints.h:87
 
@ JOIN_ORDER_HINT_ENUM
Definition: opt_hints.h:79
 
@ SUBQUERY_HINT_ENUM
Definition: opt_hints.h:75
 
@ SKIP_SCAN_HINT_ENUM
Definition: opt_hints.h:83
 
@ QB_NAME_HINT_ENUM
Definition: opt_hints.h:73
 
@ ICP_HINT_ENUM
Definition: opt_hints.h:69
 
@ JOIN_INDEX_HINT_ENUM
Definition: opt_hints.h:86
 
@ MAX_EXEC_TIME_HINT_ENUM
Definition: opt_hints.h:72
 
@ HASH_JOIN_HINT_ENUM
Definition: opt_hints.h:84
 
@ MRR_HINT_ENUM
Definition: opt_hints.h:70
 
@ JOIN_FIXED_ORDER_HINT_ENUM
Definition: opt_hints.h:80
 
@ INDEX_HINT_ENUM
Definition: opt_hints.h:85
 
@ BKA_HINT_ENUM
Definition: opt_hints.h:67
 
@ NO_RANGE_HINT_ENUM
Definition: opt_hints.h:71
 
@ SEMIJOIN_HINT_ENUM
Definition: opt_hints.h:74
 
void append_table_name(const THD *thd, String *str, const LEX_CSTRING *qb_name, const LEX_CSTRING *table_name)
Append table and query block name.
Definition: opt_hints.cc:1464
 
bool hint_key_state(const THD *thd, const Table_ref *table, uint keyno, opt_hints_enum type_arg, uint optimizer_switch)
Returns key hint value if hint is specified, returns optimizer switch value if hint is not specified.
Definition: opt_hints.cc:1435
 
int cmp_lex_string(const LEX_CSTRING &s, const LEX_CSTRING &t, const CHARSET_INFO *cs)
Definition: opt_hints.cc:110
 
required string type
Definition: replication_group_member_actions.proto:34
 
Our own string classes, used pervasively throughout the executor.
 
#define STRING_WITH_LEN(X)
Definition: string_with_len.h:29
 
Definition: m_ctype.h:421
 
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
 
Definition: mysql_lex_string.h:40
 
Represents an expression tree in the relational algebra of joins.
Definition: relational_expression.h:155
 
Definition: opt_hints.h:93
 
bool switch_hint
Definition: opt_hints.h:97
 
bool irregular_hint
true if hint requires some special handling.
Definition: opt_hints.h:98
 
bool check_upper_lvl
Definition: opt_hints.h:95
 
const char * hint_name
Definition: opt_hints.h:94