MySQL 8.0.39
Source Code Documentation
rowid_ordered_retrieval_plan.h
Go to the documentation of this file.
1/* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef SQL_RANGE_OPTIMIZER_ROWID_ORDERED_RETRIEVAL_PLAN_H_
25#define SQL_RANGE_OPTIMIZER_ROWID_ORDERED_RETRIEVAL_PLAN_H_
26
27#include <sys/types.h>
28
29#include "my_base.h"
30#include "my_bitmap.h"
31#include "sql/handler.h"
33
35class RANGE_OPT_PARAM;
36class SEL_ROOT;
37class SEL_TREE;
38struct MEM_ROOT;
39
40// TODO(sgunders): Consider whether we can create INDEX_RANGE_SCAN AccessPaths
41// directly, instead of first creating this structure and then creating
42// AccessPaths from it.
44 uint idx; ///< # of used key in param->keys
45 uint keynr; ///< # of used key in table
46 ha_rows records; ///< estimate of # records this scan will return
47
48 /** Set of intervals over key fields that will be used for row retrieval. */
50
51 /** Fields used in the query and covered by this ROR scan. */
53 /**
54 Fields used in the query that are a) covered by this ROR scan and
55 b) not already covered by ROR scans ordered earlier in the merge
56 sequence.
57 */
59 /** Number of fields in covered_fields_remaining (caching of
60 * bitmap_bits_set()) */
62
63 /**
64 Cost of reading all index records with values in sel_arg intervals set
65 (assuming there is no need to access full table records)
66 */
68
69 /**
70 The ranges to scan for this index. Must be allocated on the return_mem_root.
71 */
74};
75
77 THD *thd, const RANGE_OPT_PARAM *param, TABLE *table,
78 bool index_merge_intersect_allowed, SEL_TREE *tree,
79 const MY_BITMAP *needed_fields, double cost_est,
80 bool force_index_merge_result, bool reuse_handler);
81
83 const RANGE_OPT_PARAM *param,
84 Opt_trace_object *trace_object);
85
87 const RANGE_OPT_PARAM *param,
88 Opt_trace_object *trace_object);
89
91 String *key_names,
92 String *used_lengths);
93
95 String *used_lengths);
96
97#ifndef NDEBUG
98void dbug_dump_rowid_intersection(int indent, bool verbose,
99 const Mem_root_array<AccessPath *> &children);
100
101void dbug_dump_rowid_union(int indent, bool verbose,
102 const Mem_root_array<AccessPath *> &children);
103#endif
104
105#endif // SQL_RANGE_OPTIMIZER_ROWID_ORDERED_RETRIEVAL_PLAN_H_
A wrapper class which provides array bounds checking.
Definition: sql_array.h:47
Used to store optimizer cost estimates.
Definition: handler.h:3706
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:426
A JSON object (unordered set of key/value pairs).
Definition: opt_trace.h:799
Definition: range_opt_param.h:29
A graph of (possible multiple) key ranges, represented as a red-black binary tree.
Definition: tree.h:68
Definition: tree.h:871
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:168
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1140
static uint verbose
Definition: mysqlcheck.cc:65
static char * path
Definition: mysqldump.cc:137
void add_keys_and_lengths_rowid_union(const AccessPath *path, String *key_names, String *used_lengths)
Definition: rowid_ordered_retrieval_plan.cc:1065
AccessPath * get_best_ror_intersect(THD *thd, const RANGE_OPT_PARAM *param, TABLE *table, bool index_merge_intersect_allowed, SEL_TREE *tree, const MY_BITMAP *needed_fields, double cost_est, bool force_index_merge_result, bool reuse_handler)
Definition: rowid_ordered_retrieval_plan.cc:770
void add_keys_and_lengths_rowid_intersection(const AccessPath *path, String *key_names, String *used_lengths)
Definition: rowid_ordered_retrieval_plan.cc:1030
void dbug_dump_rowid_union(int indent, bool verbose, const Mem_root_array< AccessPath * > &children)
Definition: rowid_ordered_retrieval_plan.cc:1090
void trace_basic_info_rowid_intersection(THD *thd, const AccessPath *path, const RANGE_OPT_PARAM *param, Opt_trace_object *trace_object)
Definition: rowid_ordered_retrieval_plan.cc:81
void trace_basic_info_rowid_union(THD *thd, const AccessPath *path, const RANGE_OPT_PARAM *param, Opt_trace_object *trace_object)
Definition: rowid_ordered_retrieval_plan.cc:99
void dbug_dump_rowid_intersection(int indent, bool verbose, const Mem_root_array< AccessPath * > &children)
Definition: rowid_ordered_retrieval_plan.cc:1080
Access paths are a query planning structure that correspond 1:1 to iterators, in that an access path ...
Definition: access_path.h:193
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
Definition: my_bitmap.h:43
Definition: rowid_ordered_retrieval_plan.h:43
Cost_estimate index_read_cost
Cost of reading all index records with values in sel_arg intervals set (assuming there is no need to ...
Definition: rowid_ordered_retrieval_plan.h:67
uint num_covered_fields_remaining
Number of fields in covered_fields_remaining (caching of bitmap_bits_set())
Definition: rowid_ordered_retrieval_plan.h:61
uint keynr
Definition: rowid_ordered_retrieval_plan.h:45
SEL_ROOT * sel_root
Set of intervals over key fields that will be used for row retrieval.
Definition: rowid_ordered_retrieval_plan.h:49
uint idx
Definition: rowid_ordered_retrieval_plan.h:44
uint used_key_parts
Definition: rowid_ordered_retrieval_plan.h:73
ha_rows records
estimate of # records this scan will return
Definition: rowid_ordered_retrieval_plan.h:46
MY_BITMAP covered_fields_remaining
Fields used in the query that are a) covered by this ROR scan and b) not already covered by ROR scans...
Definition: rowid_ordered_retrieval_plan.h:58
MY_BITMAP covered_fields
Fields used in the query and covered by this ROR scan.
Definition: rowid_ordered_retrieval_plan.h:52
Bounds_checked_array< QUICK_RANGE * > ranges
The ranges to scan for this index.
Definition: rowid_ordered_retrieval_plan.h:72
Definition: table.h:1399
unsigned int uint
Definition: uca9-dump.cc:75