MySQL 8.3.0
Source Code Documentation
range_opt_param.h
Go to the documentation of this file.
1/* Copyright (c) 2000, 2023, 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 also distributed 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 included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef SQL_RANGE_OPTIMIZER_RANGE_OPT_PARAM_H_
24#define SQL_RANGE_OPTIMIZER_RANGE_OPT_PARAM_H_
25
27
29 public:
30 TABLE *table; /* Table being analyzed */
31 Query_block *query_block; /* Query block the table is part of */
32
33 /* Array of parts of all keys for which range analysis is performed */
36 // Memory used for allocating AccessPaths and similar
37 // objects that are required for a later call to make_quick(), as well as
38 // RowIterator objects and allocations they need to do themselves.
39 // Typically points to thd->mem_root, but DynamicRangeIterator uses its
40 // own MEM_ROOT here, as it needs to delete all the old data and allocate
41 // new objects. Note that not all data allocated here will indeed be used;
42 // e.g., we may allocate five AccessPaths here but only choose to use one
43 // of them.
45 // Memory that will be freed when range analysis completes.
46 // In particular, this contains the tree built up to analyze
47 // the input expressions (SEL_TREE), but not the actual scan ranges
48 // decided on and given to the AccessPath (Quick_range).
50 /*
51 Number of indexes used in range analysis (In SEL_TREE::keys only first
52 #keys elements are not empty)
53 */
54 uint keys;
55
56 /*
57 If true, the index descriptions describe real indexes (and it is ok to
58 call field->optimize_range(real_keynr[...], ...).
59 Otherwise index description describes fake indexes, like a partitioning
60 expression.
61 */
63
64 /*
65 used_key_no -> table_key_no translation table. Only makes sense if
66 using_real_indexes==true
67 */
68 uint *real_keynr = nullptr;
69
70 /**
71 Whether index statistics or index dives should be used when
72 estimating the number of rows in an equality range. If true, index
73 statistics is used for these indexes.
74 */
76
77 /// Error handler for this param.
78
80
81 bool has_errors() const { return (error_handler.has_errors()); }
82
83 KEY_PART **key = nullptr; /* First key parts of keys used in the query */
84};
85
86#endif // SQL_RANGE_OPTIMIZER_RANGE_OPT_PARAM_H_
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:1161
Definition: range_opt_param.h:28
Query_block * query_block
Definition: range_opt_param.h:31
uint keys
Definition: range_opt_param.h:54
uint * real_keynr
Definition: range_opt_param.h:68
bool use_index_statistics
Whether index statistics or index dives should be used when estimating the number of rows in an equal...
Definition: range_opt_param.h:75
TABLE * table
Definition: range_opt_param.h:30
Range_optimizer_error_handler error_handler
Error handler for this param.
Definition: range_opt_param.h:79
KEY_PART * key_parts_end
Definition: range_opt_param.h:35
KEY_PART ** key
Definition: range_opt_param.h:83
bool has_errors() const
Definition: range_opt_param.h:81
bool using_real_indexes
Definition: range_opt_param.h:62
MEM_ROOT * return_mem_root
Definition: range_opt_param.h:44
KEY_PART * key_parts
Definition: range_opt_param.h:34
MEM_ROOT * temp_mem_root
Definition: range_opt_param.h:49
Error handling class for range optimizer.
Definition: internal.h:74
bool has_errors() const
Definition: internal.h:102
Definition: range_optimizer.h:54
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:82
Definition: table.h:1403