MySQL 8.4.2
Source Code Documentation
index_skip_scan_plan.h File Reference
#include <sys/types.h>
#include "my_base.h"
#include "sql/range_optimizer/range_optimizer.h"

Go to the source code of this file.

Classes

struct  EQPrefix
 
struct  IndexSkipScanParameters
 Logically a part of AccessPath::index_skip_scan(), but is too large, so split out into its own struct. More...
 

Functions

Mem_root_array< AccessPath * > get_all_skip_scans (THD *thd, RANGE_OPT_PARAM *param, SEL_TREE *tree, enum_order order_direction, bool skip_records_in_range, bool force_skip_scan)
 Test if skip scan is applicable and if so, construct a new AccessPath for each candidate index skip scan. More...
 
AccessPathget_best_skip_scan (THD *thd, RANGE_OPT_PARAM *param, SEL_TREE *tree, enum_order order_direction, bool skip_records_in_range, bool force_skip_scan)
 Test if skip scan is applicable and if so, construct a new AccessPath. More...
 
void trace_basic_info_index_skip_scan (THD *thd, const AccessPath *path, const RANGE_OPT_PARAM *param, Opt_trace_object *trace_object)
 
void dbug_dump_index_skip_scan (int indent, bool verbose, const AccessPath *path)
 

Function Documentation

◆ dbug_dump_index_skip_scan()

void dbug_dump_index_skip_scan ( int  indent,
bool  verbose,
const AccessPath path 
)

◆ get_all_skip_scans()

Mem_root_array< AccessPath * > get_all_skip_scans ( THD thd,
RANGE_OPT_PARAM param,
SEL_TREE tree,
enum_order  order_direction,
bool  skip_records_in_range,
bool  force_skip_scan 
)

Test if skip scan is applicable and if so, construct a new AccessPath for each candidate index skip scan.

Parameters
thdThread info
paramParameter from test_quick_select
treeRange tree generated by get_mm_tree
order_directionThe sort order the range access method must be able to provide. Three-value logic: asc/desc/don't care
skip_records_in_rangeSame value as JOIN_TAB::skip_records_in_range()
force_skip_scanTRUE if skip scan is forced by optimizer hint
Return values
Mem_root_arrayof candidate INDEX_SKIP_SCAN AccessPaths.

◆ get_best_skip_scan()

AccessPath * get_best_skip_scan ( THD thd,
RANGE_OPT_PARAM param,
SEL_TREE tree,
enum_order  order_direction,
bool  skip_records_in_range,
bool  force_skip_scan 
)

Test if skip scan is applicable and if so, construct a new AccessPath.

DESCRIPTION Test whether a query can be computed via a IndexSkipScanIterator. The overall query form should look like this:

SELECT A_1,...,A_k, B_1,...,B_m, C FROM T WHERE EQ(A_1,...,A_k) AND RNG(C);

Queries computable via a IndexSkipScanIterator must satisfy the following conditions:

A) Table T has at least one compound index I of the form: I = <A_1,...,A_k, B_1,..., B_m, C ,[D_1,...,D_n]> Keyparts A and D may be empty, but B and C must be non-empty. B) Only one table referenced. C) Cannot have group by/select distinct D) Query must reference fields in the index only. E) The predicates on A_1...A_k must be equality predicates and they need to be constants. This includes the 'IN' operator. F) The query must be a conjunctive query. In other words, it is a AND of ORs: (COND1(kp1) OR COND2(kp1)) AND (COND1(kp2) OR ...) AND ... See get_sel_arg_for_keypart for details. G) There must be a range condition on C. H) Conditions on D columns are allowed. Conditions on D must be in conjunction with range condition on C.

NOTES If the current query satisfies the conditions above, and if (mem_root! = NULL), then the function constructs and returns a new AccessPath object, that is later used to construct a new IndexSkipScanIterator.

Parameters
thdThread info
paramParameter from test_quick_select
treeRange tree generated by get_mm_tree
order_directionThe sort order the range access method must be able to provide. Three-value logic: asc/desc/don't care
skip_records_in_rangeSame value as JOIN_TAB::skip_records_in_range()
force_skip_scanTRUE if skip scan is forced by optimizer hint
Return values
NULL,ifskip index scan not applicable, otherwise index skip scan access path.

◆ trace_basic_info_index_skip_scan()

void trace_basic_info_index_skip_scan ( THD thd,
const AccessPath path,
const RANGE_OPT_PARAM param,
Opt_trace_object trace_object 
)