![]() |
MySQL 8.0.43
Source Code Documentation
|
#include "sql/range_optimizer/index_range_scan_plan.h"#include <assert.h>#include <string.h>#include <algorithm>#include <memory>#include "m_ctype.h"#include "my_alloc.h"#include "my_base.h"#include "my_inttypes.h"#include "my_sys.h"#include "sql/join_optimizer/access_path.h"#include "sql/key.h"#include "sql/mem_root_array.h"#include "sql/opt_hints.h"#include "sql/opt_trace.h"#include "sql/opt_trace_context.h"#include "sql/range_optimizer/geometry_index_range_scan.h"#include "sql/range_optimizer/index_range_scan.h"#include "sql/range_optimizer/internal.h"#include "sql/range_optimizer/range_opt_param.h"#include "sql/range_optimizer/range_optimizer.h"#include "sql/range_optimizer/reverse_index_range_scan.h"#include "sql/range_optimizer/tree.h"#include "sql/sql_bitmap.h"#include "sql/sql_class.h"#include "sql/sql_lex.h"#include "sql/sql_select.h"#include "sql/table.h"#include "sql/thr_malloc.h"#include "sql_string.h"Classes | |
| struct | RANGE_SEQ_ENTRY |
| class | Sel_arg_range_sequence |
Functions | |
| static bool | is_key_scan_ror (RANGE_OPT_PARAM *param, uint keynr, uint nparts) |
| static bool | eq_ranges_exceeds_limit (const SEL_ROOT *keypart, uint *count, uint limit) |
| Traverse the R-B range tree for this and later keyparts to see if there are at least as many equality ranges as defined by the limit. More... | |
| static bool | get_ranges_from_tree_given_base (THD *thd, MEM_ROOT *return_mem_root, const KEY *table_key, KEY_PART *key, SEL_ROOT *key_tree, uchar *const base_min_key, uchar *min_key, uint min_key_flag, uchar *const base_max_key, uchar *max_key, uint max_key_flag, bool first_keypart_is_asc, uint num_key_parts, uint *used_key_parts, uint *num_exact_key_parts, Quick_ranges *ranges) |
| Generate key values for range select from given sel_arg tree. More... | |
| static range_seq_t | sel_arg_range_seq_init (void *init_param, uint, uint) |
| static uint | sel_arg_range_seq_next (range_seq_t rseq, KEY_MULTI_RANGE *range) |
| ha_rows | check_quick_select (THD *thd, RANGE_OPT_PARAM *param, uint idx, bool index_only, SEL_ROOT *tree, bool update_tbl_stats, enum_order order_direction, bool skip_records_in_range, uint *mrr_flags, uint *bufsize, Cost_estimate *cost, bool *is_ror_scan, bool *is_imerge_scan) |
| bool | get_ranges_from_tree (MEM_ROOT *return_mem_root, TABLE *table, KEY_PART *key, uint keyno, SEL_ROOT *key_tree, uint num_key_parts, unsigned *used_key_parts, unsigned *num_exact_key_parts, Quick_ranges *ranges) |
| void | trace_basic_info_index_range_scan (THD *thd, const AccessPath *path, const RANGE_OPT_PARAM *param, Opt_trace_object *trace_object) |
| AccessPath * | get_key_scans_params (THD *thd, RANGE_OPT_PARAM *param, SEL_TREE *tree, bool index_read_must_be_used, bool update_tbl_stats, enum_order order_direction, bool skip_records_in_range, const double cost_est, bool ror_only, Key_map *needed_reg) |
| static bool | null_part_in_key (KEY_PART *key_part, const uchar *key, uint length) |
| static void | print_multiple_key_values (const KEY_PART *key_part, const uchar *key, uint used_length) |
| void | dbug_dump_range (int indent, bool verbose, TABLE *table, int index, KEY_PART *used_key_part, Bounds_checked_array< QUICK_RANGE * > ranges) |
| ha_rows check_quick_select | ( | THD * | thd, |
| RANGE_OPT_PARAM * | param, | ||
| uint | idx, | ||
| bool | index_only, | ||
| SEL_ROOT * | tree, | ||
| bool | update_tbl_stats, | ||
| enum_order | order_direction, | ||
| bool | skip_records_in_range, | ||
| uint * | mrr_flags, | ||
| uint * | bufsize, | ||
| Cost_estimate * | cost, | ||
| bool * | is_ror_scan, | ||
| bool * | is_imerge_scan | ||
| ) |
| void dbug_dump_range | ( | int | indent, |
| bool | verbose, | ||
| TABLE * | table, | ||
| int | index, | ||
| KEY_PART * | used_key_part, | ||
| Bounds_checked_array< QUICK_RANGE * > | ranges | ||
| ) |
Traverse the R-B range tree for this and later keyparts to see if there are at least as many equality ranges as defined by the limit.
| keypart | The R-B tree of ranges for a given keypart. | |
| [in,out] | count | The number of equality ranges found so far |
| limit | The number of ranges |
| true | if limit > 0 and 'limit' or more equality ranges have been found in the range R-B trees |
| false | otherwise |
| AccessPath * get_key_scans_params | ( | THD * | thd, |
| RANGE_OPT_PARAM * | param, | ||
| SEL_TREE * | tree, | ||
| bool | index_read_must_be_used, | ||
| bool | update_tbl_stats, | ||
| enum_order | order_direction, | ||
| bool | skip_records_in_range, | ||
| const double | cost_est, | ||
| bool | ror_only, | ||
| Key_map * | needed_reg | ||
| ) |
No cost calculation when index dive is skipped.
| bool get_ranges_from_tree | ( | MEM_ROOT * | return_mem_root, |
| TABLE * | table, | ||
| KEY_PART * | key, | ||
| uint | keyno, | ||
| SEL_ROOT * | key_tree, | ||
| uint | num_key_parts, | ||
| unsigned * | used_key_parts, | ||
| unsigned * | num_exact_key_parts, | ||
| Quick_ranges * | ranges | ||
| ) |
|
static |
Generate key values for range select from given sel_arg tree.
SYNOPSIS get_ranges_from_tree_given_base()
| thd | THD object |
| return_mem_root | MEM_ROOT to use for allocating the data |
| key | Generate key values for this key |
| key_tree | SEL_ARG tree |
| base_min_key | Start of min key buffer |
| min_key | Current append place in min key buffer |
| min_key_flag | Min key's flags |
| base_max_key | Start of max key buffer |
| max_key | Current append place in max key buffer |
| max_key_flag | Max key's flags |
| first_keypart_is_asc | Whether first keypart is ascending or not |
| num_key_parts | Number of key parts that should be used for creating ranges |
| used_key_parts | Number of key parts that were ever used in some form |
| num_exact_key_parts | The number of key parts for which we were able to apply the ranges fully (never higher than used_key_parts), subsuming conditions touching that key part. |
| ranges | The ranges to scan |
|
static |
|
static |
|
static |
|
static |
| void trace_basic_info_index_range_scan | ( | THD * | thd, |
| const AccessPath * | path, | ||
| const RANGE_OPT_PARAM * | param, | ||
| Opt_trace_object * | trace_object | ||
| ) |