MySQL 9.1.0
Source Code Documentation
materialize_path_parameters.h
Go to the documentation of this file.
1/* Copyright (c) 2020, 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 MATERIALIZE_PATH_PARAMETERS_H
25#define MATERIALIZE_PATH_PARAMETERS_H 1
26
27// Split out into its own file to reduce the amount of dependencies on
28// access_path.h.
29
30#include "sql/mem_root_array.h"
31#include "sql/sql_class.h"
32
33struct AccessPath;
34struct TABLE;
35class JOIN;
39
41 // Corresponds to MaterializeIterator::Operand; see it for documentation.
42 struct Operand {
50 /// The block no is the first to be materialized with DISTINCT: for EXCEPT
51 /// set operation in a materialization for EXCEPT.
53 /// The index of this block number
55 /// The number of materialized blocks, i.e. set operands
57 };
60
61 /// Handle to table to materialize into.
63
64 /// If materializing a CTE, points to it (see m_cte), otherwise nullptr.
66
67 /// The query expression we are materializing.
69
70 /**
71 @see JOIN. If we are materializing across JOINs, e.g. derived tables,
72 ref_slice should be left at -1.
73 */
75
76 /**
77 True if rematerializing on every Init() call (e.g., because we
78 have a dependency on a value from outside the query block).
79 */
81
82 /**
83 Used for when pushing LIMIT down to MaterializeIterator; this is
84 more efficient than having a LimitOffsetIterator above the
85 MaterializeIterator, since we can stop materializing when there are
86 enough rows. (This is especially important for recursive CTEs.)
87 Note that we cannot have a LimitOffsetIterator _below_ the
88 MaterializeIterator, as that would count wrong if we have deduplication,
89 and would not work at all for recursive CTEs.
90 Set to HA_POS_ERROR for no limit.
91 */
93
94 /**
95 True if this is the top level iterator for a
96 materialized derived table transformed from a scalar subquery which needs
97 run-time cardinality check.
98 */
100
101 /**
102 The context for which deduplication is being used. Note: this
103 deduplication is different than the deduplication for UNION which is
104 handled separately, not through this enum.
105 */
106 enum DedupType : uint8_t {
107 DEDUP_FOR_DISTINCT, // materialization is for DISTINCT clause.
108 DEDUP_FOR_GROUP_BY, // materialization is for GROUP BY clause.
109 NO_DEDUP // for anything else, including UNION/INTERSECT.
110 };
112};
113
114#endif // !defined(MATERIALIZE_PATH_PARAMETERS_H)
After parsing, a Common Table Expression is accessed through a Table_ref.
Definition: table.h:4484
Definition: sql_optimizer.h:133
This class represents a query expression (one query block or several query blocks combined with UNION...
Definition: sql_lex.h:627
Object containing parameters used when creating and using temporary tables.
Definition: temp_table_param.h:97
my_off_t ha_rows
Definition: my_base.h:1141
Access paths are a query planning structure that correspond 1:1 to iterators, in that an access path ...
Definition: access_path.h:227
Definition: materialize_path_parameters.h:42
bool is_recursive_reference
Definition: materialize_path_parameters.h:49
AccessPath * subquery_path
Definition: materialize_path_parameters.h:43
int select_number
Definition: materialize_path_parameters.h:44
JOIN * join
Definition: materialize_path_parameters.h:45
bool copy_items
Definition: materialize_path_parameters.h:47
uint m_total_operands
The number of materialized blocks, i.e. set operands.
Definition: materialize_path_parameters.h:56
uint m_first_distinct
The block no is the first to be materialized with DISTINCT: for EXCEPT set operation in a materializa...
Definition: materialize_path_parameters.h:52
uint m_operand_idx
The index of this block number.
Definition: materialize_path_parameters.h:54
Temp_table_param * temp_table_param
Definition: materialize_path_parameters.h:48
bool disable_deduplication_by_hash_field
Definition: materialize_path_parameters.h:46
Definition: materialize_path_parameters.h:40
bool rematerialize
True if rematerializing on every Init() call (e.g., because we have a dependency on a value from outs...
Definition: materialize_path_parameters.h:80
DedupType deduplication_reason
Definition: materialize_path_parameters.h:111
Mem_root_array< Operand > m_operands
Definition: materialize_path_parameters.h:58
Common_table_expr * cte
If materializing a CTE, points to it (see m_cte), otherwise nullptr.
Definition: materialize_path_parameters.h:65
DedupType
The context for which deduplication is being used.
Definition: materialize_path_parameters.h:106
@ DEDUP_FOR_DISTINCT
Definition: materialize_path_parameters.h:107
@ NO_DEDUP
Definition: materialize_path_parameters.h:109
@ DEDUP_FOR_GROUP_BY
Definition: materialize_path_parameters.h:108
bool reject_multiple_rows
True if this is the top level iterator for a materialized derived table transformed from a scalar sub...
Definition: materialize_path_parameters.h:99
ha_rows limit_rows
Used for when pushing LIMIT down to MaterializeIterator; this is more efficient than having a LimitOf...
Definition: materialize_path_parameters.h:92
TABLE * table
Handle to table to materialize into.
Definition: materialize_path_parameters.h:62
int ref_slice
Definition: materialize_path_parameters.h:74
Query_expression * unit
The query expression we are materializing.
Definition: materialize_path_parameters.h:68
Mem_root_array< const AccessPath * > * invalidators
Definition: materialize_path_parameters.h:59
Definition: table.h:1421