MySQL 8.4.2
Source Code Documentation
internal.h File Reference

Go to the source code of this file.

Classes

class  Range_optimizer_error_handler
 Error handling class for range optimizer. More...
 
class  SEL_IMERGE
 

Namespaces

namespace  opt_range
 Shared sentinel node for all trees.
 

Macros

#define double2rows(x)   ((ha_rows)(x))
 

Functions

void print_tree (String *out, const char *tree_name, SEL_TREE *tree, const RANGE_OPT_PARAM *param, const bool print_full)
 
void append_range (String *out, const KEY_PART_INFO *key_parts, const uchar *min_key, const uchar *max_key, const uint flag)
 Append range info for a key part to a string. More...
 
void append_range_all_keyparts (Opt_trace_array *range_trace, String *range_string, String *range_so_far, SEL_ROOT *keypart, const KEY_PART_INFO *key_parts, const bool print_full)
 Traverse an R-B tree of range conditions and append all ranges for this keypart and consecutive keyparts to range_trace (if non-NULL) or to range_string (if range_trace is NULL). More...
 
void append_range_to_string (const QUICK_RANGE *range, const KEY_PART_INFO *first_key_part, String *out)
 
int index_next_different (bool is_index_scan, handler *file, KEY_PART_INFO *key_part, uchar *record, const uchar *group_prefix, uint group_prefix_len, uint group_key_parts)
 Find the next different key value by skipping all the rows with the same key value. More...
 
void print_key_value (String *out, const KEY_PART_INFO *key_part, const uchar *key)
 Print a key to a string. More...
 

Variables

SEL_ARGopt_range::null_element = nullptr
 

Macro Definition Documentation

◆ double2rows

#define double2rows (   x)    ((ha_rows)(x))

Function Documentation

◆ append_range()

void append_range ( String out,
const KEY_PART_INFO key_part,
const uchar min_key,
const uchar max_key,
const uint  flag 
)

Append range info for a key part to a string.

Parameters
[in,out]outString the range info is appended to
[in]key_partIndexed column used in a range select
[in]min_keyKey tuple describing lower bound of range
[in]max_keyKey tuple describing upper bound of range
[in]flagKey range flags defining what min_key and max_key represent
See also
my_base.h

◆ append_range_all_keyparts()

void append_range_all_keyparts ( Opt_trace_array range_trace,
String range_string,
String range_so_far,
SEL_ROOT keypart,
const KEY_PART_INFO key_parts,
const bool  print_full 
)

Traverse an R-B tree of range conditions and append all ranges for this keypart and consecutive keyparts to range_trace (if non-NULL) or to range_string (if range_trace is NULL).

See description of R-B trees/SEL_ARG for details on how ranges are linked.

Parameters
[in,out]range_traceOptimizer trace array ranges are appended to
[in,out]range_stringThe string where range predicates are appended when the last keypart has been reached.
range_so_farString containing ranges for keyparts prior to this keypart.
keypartThe R-B tree containing intervals for this keypart.
key_partsIndex components description, used when adding information to the optimizer trace
print_fullWhether or not ranges on unusable keyparts should be printed. Useful for debugging.
Note
This function mimics the behavior of sel_arg_range_seq_next()

◆ append_range_to_string()

void append_range_to_string ( const QUICK_RANGE range,
const KEY_PART_INFO first_key_part,
String out 
)

◆ index_next_different()

int index_next_different ( bool  is_index_scan,
handler file,
KEY_PART_INFO key_part,
uchar record,
const uchar group_prefix,
uint  group_prefix_len,
uint  group_key_parts 
)

Find the next different key value by skipping all the rows with the same key value.

Implements a specialized loose index access method for queries containing aggregate functions with distinct of the form: SELECT SUM|COUNT|AVG FROM t This method comes to replace the index scan + Unique class (distinct selection) for loose index scan that visits all the rows of a covering index instead of jumping in the beginning of each group. TODO: Placeholder function. To be replaced by a handler API call

Parameters
is_index_scanhint to use index scan instead of random index read to find the next different value.
filetable handler
key_partgroup key to compare
recordrow data
group_prefixcurrent key prefix data
group_prefix_lenlength of the current key prefix data
group_key_partsnumber of the current key prefix columns
Returns
status
Return values
0success
!0failure

◆ print_key_value()

void print_key_value ( String out,
const KEY_PART_INFO key_part,
const uchar key 
)

Print a key to a string.

Parameters
[out]outString the key is appended to
[in]key_partIndex components description
[in]keyKey tuple

◆ print_tree()

void print_tree ( String out,
const char *  tree_name,
SEL_TREE tree,
const RANGE_OPT_PARAM param,
const bool  print_full 
)