MySQL 8.4.3
Source Code Documentation
opt_hints.h File Reference
#include <assert.h>
#include <stddef.h>
#include <sys/types.h>
#include "lex_string.h"
#include "my_compiler.h"
#include "my_inttypes.h"
#include "mysql/strings/m_ctype.h"
#include "sql/enum_query_type.h"
#include "sql/mem_root_array.h"
#include "sql/sql_bitmap.h"
#include "sql/sql_show.h"
#include "sql_string.h"
#include "string_with_len.h"

Go to the source code of this file.

Classes

struct  st_opt_hint_info
 
class  Opt_hints_map
 Opt_hints_map contains information about hint state(specified or not, hint value). More...
 
class  Opt_hints
 Opt_hints class is used as ancestor for Opt_hints_global, Opt_hints_qb, Opt_hints_table, Opt_hints_key classes. More...
 
class  Opt_hints_global
 Global level hints. More...
 
class  Opt_hints_qb
 Query block level hints. More...
 
class  Compound_key_hint
 Auxiliary class for compound key objects. More...
 
class  Index_key_hint
 Auxiliary class for JOIN_INDEX, GROUP_INDEX, ORDER_INDEX hints. More...
 
class  Glob_index_key_hint
 Auxiliary class for INDEX hint. More...
 
class  Opt_hints_table
 Table level hints. More...
 
class  Opt_hints_key
 Key level hints. More...
 
class  Hint_set_var
 Container for set_var object and original variable value. More...
 
class  Sys_var_hint
 SET_VAR hints. More...
 

Enumerations

enum  opt_hints_enum {
  BKA_HINT_ENUM = 0 , BNL_HINT_ENUM , ICP_HINT_ENUM , MRR_HINT_ENUM ,
  NO_RANGE_HINT_ENUM , MAX_EXEC_TIME_HINT_ENUM , QB_NAME_HINT_ENUM , SEMIJOIN_HINT_ENUM ,
  SUBQUERY_HINT_ENUM , DERIVED_MERGE_HINT_ENUM , JOIN_PREFIX_HINT_ENUM , JOIN_SUFFIX_HINT_ENUM ,
  JOIN_ORDER_HINT_ENUM , JOIN_FIXED_ORDER_HINT_ENUM , INDEX_MERGE_HINT_ENUM , RESOURCE_GROUP_HINT_ENUM ,
  SKIP_SCAN_HINT_ENUM , HASH_JOIN_HINT_ENUM , INDEX_HINT_ENUM , JOIN_INDEX_HINT_ENUM ,
  GROUP_INDEX_HINT_ENUM , ORDER_INDEX_HINT_ENUM , DERIVED_CONDITION_PUSHDOWN_HINT_ENUM , MAX_HINT_ENUM
}
 Hint types, MAX_HINT_ENUM should be always last. More...
 

Functions

bool is_compound_hint (opt_hints_enum type_arg)
 
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. More...
 
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 specified. More...
 
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. More...
 
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. More...
 
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. More...
 
int cmp_lex_string (const LEX_CSTRING &s, const LEX_CSTRING &t, const CHARSET_INFO *cs)
 

Enumeration Type Documentation

◆ opt_hints_enum

Hint types, MAX_HINT_ENUM should be always last.

This enum should be synchronized with opt_hint_info array(see opt_hints.cc).

Enumerator
BKA_HINT_ENUM 
BNL_HINT_ENUM 
ICP_HINT_ENUM 
MRR_HINT_ENUM 
NO_RANGE_HINT_ENUM 
MAX_EXEC_TIME_HINT_ENUM 
QB_NAME_HINT_ENUM 
SEMIJOIN_HINT_ENUM 
SUBQUERY_HINT_ENUM 
DERIVED_MERGE_HINT_ENUM 
JOIN_PREFIX_HINT_ENUM 
JOIN_SUFFIX_HINT_ENUM 
JOIN_ORDER_HINT_ENUM 
JOIN_FIXED_ORDER_HINT_ENUM 
INDEX_MERGE_HINT_ENUM 
RESOURCE_GROUP_HINT_ENUM 
SKIP_SCAN_HINT_ENUM 
HASH_JOIN_HINT_ENUM 
INDEX_HINT_ENUM 
JOIN_INDEX_HINT_ENUM 
GROUP_INDEX_HINT_ENUM 
ORDER_INDEX_HINT_ENUM 
DERIVED_CONDITION_PUSHDOWN_HINT_ENUM 
MAX_HINT_ENUM 

Function Documentation

◆ append_table_name()

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.

Parameters
thdpointer to THD object
strpointer to String object
qb_namepointer to query block name, may be null
table_namepointer to table name

◆ cmp_lex_string()

int cmp_lex_string ( const LEX_CSTRING s,
const LEX_CSTRING t,
const CHARSET_INFO cs 
)

◆ compound_hint_key_enabled()

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.

If compound hint state is on and hint is specified without indexes, function returns 'true' for any 'keyno' argument. If hint specified with indexes, function returns true only for appropriate 'keyno' index.

Parameters
tablePointer to TABLE object
keynoKey number
type_argHint type
Returns
true if compound hint state is on with or without specified keys, otherwise returns false.

◆ hint_key_state()

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.

Parameters
thdPointer to THD object
tablePointer to Table_ref object
keynoKey number
type_argHint type
optimizer_switchOptimizer switch flag
Returns
key hint value if hint is specified, otherwise optimizer switch value.

◆ hint_table_state()

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 specified.

Parameters
thdPointer to THD object
tablePointer to Table_ref object
type_argHint type
optimizer_switchOptimizer switch flag
Returns
table hint value if hint is specified, otherwise optimizer switch value.

◆ idx_merge_hint_state()

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.

Parameters
thdThread handler
tablePointer to TABLE object
use_cheapest_index_mergeIN/OUT Returns true if INDEX_MERGE hint is used without any specified key.
Returns
true if index merge hint state is on otherwise returns false.

◆ is_compound_hint()

bool is_compound_hint ( opt_hints_enum  type_arg)