MySQL 8.0.40
Source Code Documentation
|
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 | |
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. 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) |
void dbug_dump_index_skip_scan | ( | int | indent, |
bool | verbose, | ||
const AccessPath * | path | ||
) |
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.
param | Parameter from test_quick_select |
tree | Range tree generated by get_mm_tree |
order_direction | The sort order the range access method must be able to provide. Three-value logic: asc/desc/don't care |
skip_records_in_range | Same value as JOIN_TAB::skip_records_in_range() |
force_skip_scan | TRUE if skip scan is forced by optimizer hint |
NULL,if | skip index scan not applicable, otherwise skip index scan table read plan. |
void trace_basic_info_index_skip_scan | ( | THD * | thd, |
const AccessPath * | path, | ||
const RANGE_OPT_PARAM * | param, | ||
Opt_trace_object * | trace_object | ||
) |