MySQL  8.0.17
Source Code Documentation
opt_hints.h File Reference
#include <stddef.h>
#include <sys/types.h>
#include "lex_string.h"
#include "m_ctype.h"
#include "m_string.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "sql/enum_query_type.h"
#include "sql/item_subselect.h"
#include "sql/mem_root_array.h"
#include "sql/sql_bitmap.h"
#include "sql/sql_show.h"
#include "sql_string.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
 Auxiluary class for compound key objects. 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, MAX_HINT_ENUM
}
 Hint types, MAX_HINT_ENUM should be always last. More...
 

Functions

bool hint_key_state (const THD *thd, const TABLE_LIST *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_LIST *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 compoubd hint state is on with or without specified keys, otherwise returns false. More...
 
bool idx_merge_hint_state (const TABLE *table, bool *use_cheapest_index_merge)
 Returns true if index merge hint state is on otherwise returns false. More...
 

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

◆ compound_hint_key_enabled()

bool compound_hint_key_enabled ( const TABLE table,
uint  keyno,
opt_hints_enum  type_arg 
)

Returns true if compoubd 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_LIST 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_LIST 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_LIST 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_LIST 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 ( const TABLE table,
bool use_cheapest_index_merge 
)

Returns true if index merge hint state is on otherwise returns false.

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