MySQL 9.1.0
Source Code Documentation
range_opt_param.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_RANGE_OPT_PARAM_H_
25#define SQL_RANGE_OPTIMIZER_RANGE_OPT_PARAM_H_
26
28
30 public:
31 TABLE *table; /* Table being analyzed */
32 Query_block *query_block; /* Query block the table is part of */
33
34 /* Array of parts of all keys for which range analysis is performed */
37 // Memory used for allocating AccessPaths and similar
38 // objects that are required for a later call to make_quick(), as well as
39 // RowIterator objects and allocations they need to do themselves.
40 // Typically points to thd->mem_root, but DynamicRangeIterator uses its
41 // own MEM_ROOT here, as it needs to delete all the old data and allocate
42 // new objects. Note that not all data allocated here will indeed be used;
43 // e.g., we may allocate five AccessPaths here but only choose to use one
44 // of them.
46 // Memory that will be freed when range analysis completes.
47 // In particular, this contains the tree built up to analyze
48 // the input expressions (SEL_TREE), but not the actual scan ranges
49 // decided on and given to the AccessPath (Quick_range).
51 /*
52 Number of indexes used in range analysis (In SEL_TREE::keys only first
53 #keys elements are not empty)
54 */
55 uint keys;
56
57 /*
58 If true, the index descriptions describe real indexes (and it is ok to
59 call field->optimize_range(real_keynr[...], ...).
60 Otherwise index description describes fake indexes, like a partitioning
61 expression.
62 */
64
65 /*
66 used_key_no -> table_key_no translation table. Only makes sense if
67 using_real_indexes==true
68 */
69 uint *real_keynr = nullptr;
70
71 /**
72 Whether index statistics or index dives should be used when
73 estimating the number of rows in an equality range. If true, index
74 statistics is used for these indexes.
75 */
77
78 /// Error handler for this param.
79
81
82 bool has_errors() const { return (error_handler.has_errors()); }
83
84 KEY_PART **key = nullptr; /* First key parts of keys used in the query */
85};
86
87#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:1159
Definition: range_opt_param.h:29
Query_block * query_block
Definition: range_opt_param.h:32
uint keys
Definition: range_opt_param.h:55
uint * real_keynr
Definition: range_opt_param.h:69
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:76
TABLE * table
Definition: range_opt_param.h:31
Range_optimizer_error_handler error_handler
Error handler for this param.
Definition: range_opt_param.h:80
KEY_PART * key_parts_end
Definition: range_opt_param.h:36
KEY_PART ** key
Definition: range_opt_param.h:84
bool has_errors() const
Definition: range_opt_param.h:82
bool using_real_indexes
Definition: range_opt_param.h:63
MEM_ROOT * return_mem_root
Definition: range_opt_param.h:45
KEY_PART * key_parts
Definition: range_opt_param.h:35
MEM_ROOT * temp_mem_root
Definition: range_opt_param.h:50
Error handling class for range optimizer.
Definition: internal.h:75
bool has_errors() const
Definition: internal.h:103
Definition: range_optimizer.h:55
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
Definition: table.h:1421