MySQL 26.7.0
Source Code Documentation
rowid_ordered_retrieval_plan.h File Reference

Go to the source code of this file.

Classes

struct  ROR_SCAN_INFO
 
class  ROR_intersect_plan
 

Functions

AccessPath * get_best_ror_intersect (THD *thd, const RANGE_OPT_PARAM *param, TABLE *table, bool index_merge_intersect_allowed, SEL_TREE *tree, double cost_est, bool force_index_merge_result, bool reuse_handler)
 
void trace_basic_info_rowid_intersection (THD *thd, const AccessPath *path, const RANGE_OPT_PARAM *param, Opt_trace_object *trace_object)
 
void trace_basic_info_rowid_union (THD *thd, const AccessPath *path, const RANGE_OPT_PARAM *param, Opt_trace_object *trace_object)
 
void add_keys_and_lengths_rowid_intersection (const AccessPath *path, String *key_names, String *used_lengths)
 
void add_keys_and_lengths_rowid_union (const AccessPath *path, String *key_names, String *used_lengths)
 
OverflowBitset get_needed_fields (const RANGE_OPT_PARAM *param)
 
ROR_SCAN_INFO * make_ror_scan (const RANGE_OPT_PARAM *param, int idx, SEL_ROOT *sel_root, OverflowBitset needed_fields)
 
void find_intersect_order (Mem_root_array< ROR_SCAN_INFO * > *ror_scans, OverflowBitset needed_fields, MEM_ROOT *mem_root)
 Sort indexes in an order that is likely to be a good index merge intersection order. More...
 
AccessPath * MakeRowIdOrderedIndexScanAccessPath (ROR_SCAN_INFO *scan, TABLE *table, KEY_PART *used_key_part, bool reuse_handler, MEM_ROOT *mem_root)
 
void dbug_dump_rowid_intersection (int indent, bool verbose, const Mem_root_array< AccessPath * > &children)
 
void dbug_dump_rowid_union (int indent, bool verbose, const Mem_root_array< AccessPath * > &children)
 

Function Documentation

◆ add_keys_and_lengths_rowid_intersection()

void add_keys_and_lengths_rowid_intersection ( const AccessPath *  path,
String *  key_names,
String *  used_lengths 
)

◆ add_keys_and_lengths_rowid_union()

void add_keys_and_lengths_rowid_union ( const AccessPath *  path,
String *  key_names,
String *  used_lengths 
)

◆ dbug_dump_rowid_intersection()

void dbug_dump_rowid_intersection ( int  indent,
bool  verbose,
const Mem_root_array< AccessPath * > &  children 
)

◆ dbug_dump_rowid_union()

void dbug_dump_rowid_union ( int  indent,
bool  verbose,
const Mem_root_array< AccessPath * > &  children 
)

◆ find_intersect_order()

void find_intersect_order ( Mem_root_array< ROR_SCAN_INFO * > *  ror_scans,
OverflowBitset  needed_fields,
MEM_ROOT *  mem_root 
)

Sort indexes in an order that is likely to be a good index merge intersection order.

After running this function ror_scans are ordered according to this strategy:

1) Minimize the number of indexes that must be used in the intersection. I.e., the index covering most fields not already covered by other indexes earlier in the sort order is picked first. 2) When multiple indexes cover equally many uncovered fields, the index with lowest E(Number of rows) is chosen.

Note that all permutations of index ordering are not tested, so this function may not find the optimal order.

Parameters
[in,out]ror_scansror scans to be used in index merge intersection
needed_fieldsBitmask of fields needed by the query.
mem_rootmemory root to be used.

◆ get_best_ror_intersect()

AccessPath * get_best_ror_intersect ( THD *  thd,
const RANGE_OPT_PARAM *  param,
TABLE *  table,
bool  index_merge_intersect_allowed,
SEL_TREE *  tree,
double  cost_est,
bool  force_index_merge_result,
bool  reuse_handler 
)

◆ get_needed_fields()

OverflowBitset get_needed_fields ( const RANGE_OPT_PARAM *  param)

◆ make_ror_scan()

ROR_SCAN_INFO * make_ror_scan ( const RANGE_OPT_PARAM *  param,
int  idx,
SEL_ROOT *  sel_root,
OverflowBitset  needed_fields 
)

◆ MakeRowIdOrderedIndexScanAccessPath()

AccessPath * MakeRowIdOrderedIndexScanAccessPath ( ROR_SCAN_INFO *  scan,
TABLE *  table,
KEY_PART *  used_key_part,
bool  reuse_handler,
MEM_ROOT *  mem_root 
)

◆ trace_basic_info_rowid_intersection()

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

◆ trace_basic_info_rowid_union()

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