MySQL 8.4.3
Source Code Documentation
|
Query block level hints. More...
#include <opt_hints.h>
Public Member Functions | |
Opt_hints_qb (Opt_hints *opt_hints_arg, MEM_ROOT *mem_root_arg, uint select_number_arg) | |
const LEX_CSTRING * | get_print_name () override |
void | append_qb_hint (const THD *thd, String *str) |
Append query block hint. More... | |
void | append_name (const THD *thd, String *str) override |
Append query block name. More... | |
PT_hint * | get_complex_hints (opt_hints_enum type) override |
Returns pointer to complex hint for a given type. More... | |
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 corresponding key hint objects to appropriate KEY structures. More... | |
bool | semijoin_enabled (const THD *thd) const |
Returns whether semi-join is enabled for this query block. More... | |
uint | sj_enabled_strategies (uint opt_switches) const |
Returns bit mask of which semi-join strategies are enabled for this query block. More... | |
Subquery_strategy | subquery_strategy () const |
Returns which subquery execution strategy has been specified by hints for this query block. More... | |
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. More... | |
void | apply_join_order_hints (JOIN *join) |
Checks if join order hints are applicable and applies table dependencies if possible. More... | |
Public Member Functions inherited from Opt_hints | |
Opt_hints (const LEX_CSTRING *name_arg, Opt_hints *parent_arg, MEM_ROOT *mem_root_arg) | |
virtual | ~Opt_hints ()=default |
bool | is_specified (opt_hints_enum type_arg) const |
bool | set_switch (bool switch_state_arg, opt_hints_enum type_arg, bool check_parent) |
Function sets switch hint state. More... | |
bool | get_switch (opt_hints_enum type_arg) const |
Function returns switch hint state. More... | |
virtual const LEX_CSTRING * | get_name () const |
void | set_name (const LEX_CSTRING *name_arg) |
Opt_hints * | get_parent () const |
virtual void | set_resolved () |
virtual bool | is_resolved (opt_hints_enum type_arg) |
Returns 'resolved' flag value for depending on hint type. More... | |
virtual void | set_unresolved (opt_hints_enum type_arg) |
Set hint to unresolved state. More... | |
virtual bool | ignore_print (opt_hints_enum type_arg) const |
If ignore_print() returns true, hint is not printed in Opt_hints::print() function. More... | |
void | incr_resolved_children () |
Mem_root_array< Opt_hints * > * | child_array_ptr () |
bool | is_all_resolved () const |
void | register_child (Opt_hints *hint_arg) |
Opt_hints * | find_by_name (const LEX_CSTRING *name_arg, const CHARSET_INFO *cs) const |
Find hint among lower-level hint objects. More... | |
void | print (const THD *thd, String *str, enum_query_type query_type) |
Print all hints except of QB_NAME hint. More... | |
void | check_unresolved (THD *thd) |
Check if there are any unresolved hint objects and print warnings for them. More... | |
Private Member Functions | |
void | register_join_order_hint (PT_qb_level_hint *hint_arg) |
Private Attributes | |
uint | select_number |
LEX_CSTRING | sys_name |
char | buff [32] |
PT_qb_level_hint * | subquery_hint |
PT_qb_level_hint * | semijoin_hint |
Mem_root_array< PT_qb_level_hint * > | join_order_hints |
Array of join order hints. More... | |
ulonglong | join_order_hints_ignored |
Bit map of which hints are ignored. More... | |
Friends | |
class | PT_qb_level_hint |
Query block level hints.
Opt_hints_qb::Opt_hints_qb | ( | Opt_hints * | opt_hints_arg, |
MEM_ROOT * | mem_root_arg, | ||
uint | select_number_arg | ||
) |
Opt_hints_table * Opt_hints_qb::adjust_table_hints | ( | Table_ref * | table | ) |
Function finds Opt_hints_table object corresponding to table alias in the query block and attaches corresponding key hint objects to appropriate KEY structures.
table | Table reference |
Append query block name.
thd | pointer to THD object |
str | pointer to String object |
Implements Opt_hints.
Append query block hint.
thd | pointer to THD object |
str | pointer to String object |
void Opt_hints_qb::apply_join_order_hints | ( | JOIN * | join | ) |
Checks if join order hints are applicable and applies table dependencies if possible.
join | JOIN object |
|
overridevirtual |
Returns pointer to complex hint for a given type.
A complex hint is a hint that has arguments. (It is not just an on/off switch.)
type | hint type |
Reimplemented from Opt_hints.
|
inlineoverridevirtual |
Reimplemented from Opt_hints.
Function prints hints which are non-standard and don't fit into existing hint infrastructure.
thd | pointer to THD object |
str | pointer to String object |
Reimplemented from Opt_hints.
|
inlineprivate |
bool Opt_hints_qb::semijoin_enabled | ( | const THD * | thd | ) | const |
Returns whether semi-join is enabled for this query block.
A SEMIJOIN hint will force semi-join regardless of optimizer_switch settings. A NO_SEMIJOIN hint will only turn off semi-join if the variant with no strategies is used. A SUBQUERY hint will turn off semi-join. If there is no SEMIJOIN/SUBQUERY hint, optimizer_switch setting determines whether SEMIJOIN is used.
thd | Pointer to THD object for session. Used to access optimizer_switch |
uint Opt_hints_qb::sj_enabled_strategies | ( | uint | opt_switches | ) | const |
Returns bit mask of which semi-join strategies are enabled for this query block.
opt_switches | Bit map of strategies enabled by optimizer_switch |
Subquery_strategy Opt_hints_qb::subquery_strategy | ( | ) | const |
Returns which subquery execution strategy has been specified by hints for this query block.
SUBQ_MATERIALIZATION | Subquery Materialization should be used |
SUBQ_EXISTS | In-to-exists execution should be used |
UNSPECIFIED | No SUBQUERY hint for this query block |
|
friend |
|
private |
|
private |
Array of join order hints.
|
private |
Bit map of which hints are ignored.
|
private |
|
private |
|
private |
|
private |