MySQL 8.0.33
Source Code Documentation
opt_explain_format.h
Go to the documentation of this file.
1/* Copyright (c) 2011, 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 OPT_EXPLAIN_FORMAT_INCLUDED
24#define OPT_EXPLAIN_FORMAT_INCLUDED
25
26/**
27 @file sql/opt_explain_format.h
28 EXPLAIN FORMAT=@<format@> @<command@>.
29*/
30
31#include <assert.h>
32#include <sys/types.h>
33
34#include <cstring>
35
36#include "my_alloc.h" // MEM_ROOT
37#include "my_compiler.h"
38
39#include "my_inttypes.h"
40#include "my_sys.h"
42#include "sql/sql_list.h"
43#include "sql_string.h"
44
46class Query_result;
48class Window;
49class Json_object;
50
51enum class enum_explain_type;
52
53/**
54 Types of traditional "extra" column parts and property names for hierarchical
55
56 The traditional_extra_tags[] and json_extra_tags[] arrays must be in sync
57 with this enum.
58*/
95 //------------------------------------
97};
98
99/**
100 Emulate lazy computation
101*/
102class Lazy {
103 public:
104 virtual ~Lazy() = default;
105
106 /**
107 Deferred evaluation of encapsulated expression
108
109 @param [out] ret Return string value
110
111 @retval false Success
112 @retval true Failure (OOM)
113 */
114 virtual bool eval(String *ret) = 0;
115};
116
117/**
118 Base class for all EXPLAIN context descriptor classes
119
120 In structured EXPLAIN implementation Explain_context is a base class for
121 notes of an intermediate tree.
122*/
125
126 explicit Explain_context(enum_parsing_context type_arg) : type(type_arg) {}
127};
128
129namespace opt_explain_json_namespace // for forward declaration of "context"
130{
131class context;
132}
133
134// Table modification type
136
137/**
138 Helper class for table property buffering
139
140 For traditional EXPLAIN this structure contains cached data for a single
141 output row.
142
143 For hierarchical EXPLAIN this structure contains property values for a single
144 CTX_TABLE/CTX_QEP_TAB context node of the intermediate tree.
145*/
146
147class qep_row {
148 private:
149 /* Don't copy this structure */
150 explicit qep_row(const qep_row &x); // undefined
151 qep_row &operator=(const qep_row &x); // undefined
152
153 public:
154 /**
155 A wrapper for numeric table properties
156
157 For traditional EXPLAIN this structure contains a value of one cell of the
158 output row (excluding textual column values - see mem_root_str, and
159 "Extra" column - see the col_extra list).
160
161 For hierarchical EXPLAIN this structure contains a numeric property value
162 for a single CTX_TABLE/CTX_QEP_TAB context node of the intermediate tree.
163 */
164 template <typename T>
165 struct column {
166 private:
167 bool nil; ///< true if the column contains NULL
168 public:
170
171 public:
173 bool is_empty() const { return nil; }
174 void cleanup() { nil = true; }
175 void set(T value_arg) {
176 value = value_arg;
177 nil = false;
178 }
179 T get() const {
180 assert(!nil);
181 return value;
182 }
183 };
184
185 /**
186 Helper class to keep string data in MEM_ROOT before passing to Item_string
187
188 Since Item_string constructors doesn't copy input string parameter data
189 in the most cases, those input strings must have the same lifetime as
190 Item_string objects, i.e. lifetime of MEM_ROOT.
191 This class allocates input parameters for Item_string objects in MEM_ROOT.
192
193 @note Call to is_empty() is necessary before the access to "str" and
194 "length" fields, since is_empty() may trigger an evaluation of
195 an associated expression that updates these fields.
196 */
198 const char *str;
199 size_t length;
200 Lazy *
201 deferred; ///< encapsulated expression to evaluate it later (on demand)
202
204 void cleanup() {
205 str = nullptr;
206 length = 0;
207 deferred = nullptr;
208 }
209 bool is_empty();
210 bool set(const char *str_arg) { return set(str_arg, strlen(str_arg)); }
211 bool set(const String &s) { return set(s.ptr(), s.length()); }
212 /**
213 Make a copy of the string in MEM_ROOT
214
215 @param str_arg string to copy
216 @param length_arg input string length
217
218 @return false if success, true if error
219 */
220 bool set(const char *str_arg, size_t length_arg);
221
222 /**
223 Save expression for further evaluation
224
225 @param x Expression
226 */
227 void set(Lazy *x) {
228 deferred = x;
229 str = nullptr;
230 length = 0;
231 }
232 /**
233 Make a copy of string constant
234
235 Variant of set() usable when the str_arg argument lives longer
236 than the mem_root_str instance.
237 */
238 void set_const(const char *str_arg) {
239 return set_const(str_arg, strlen(str_arg));
240 }
241 void set_const(const char *str_arg, size_t length_arg) {
242 deferred = nullptr;
243 str = str_arg;
244 length = length_arg;
245 }
246
247 static char *strndup_root(MEM_ROOT *root, const char *str, size_t len) {
248 if (len == 0 || str == nullptr) return const_cast<char *>("");
249 if (str[len - 1] == 0)
250 return static_cast<char *>(memdup_root(root, str, len));
251
252 char *ret = static_cast<char *>(root->Alloc(len + 1));
253 if (ret != nullptr) {
254 memcpy(ret, str, len);
255 ret[len] = 0;
256 }
257 return ret;
258 }
259 };
260
261 /**
262 Part of traditional "extra" column or related hierarchical property
263 */
264 struct extra {
265 /**
266 A property name or a constant text head of the "extra" column part
267 */
269 /**
270 Property value or a variable tail of the "extra" column part
271
272 If data == NULL, hierarchical formatter outputs a boolean property
273 value of "true".
274 */
275 const char *const data;
276
277 explicit extra(Extra_tag tag_arg, const char *data_arg = nullptr)
278 : tag(tag_arg), data(data_arg) {}
279 };
280
281 /*
282 Next "col_*" fields are intended to be filling by "explain_*()" functions.
283
284 NOTE: NULL value or mem_root_str.is_empty()==true means that Item_null
285 object will be pushed into "items" list instead.
286 */
287 column<uint> col_id; ///< "id" column: seq. number of SELECT within the query
289 mem_root_str col_table_name; ///< "table" to which the row of output refers
290 List<const char> col_partitions; ///< "partitions" column
291 mem_root_str col_join_type; ///< "type" column, see join_type_str array
293 col_possible_keys; ///< "possible_keys": comma-separated list
295 col_key; ///< "key" column: index that is actually decided to use
296 mem_root_str col_key_len; ///< "key_length" column: length of the "key" above
298 col_ref; ///< "ref":columns/constants which are compared to "key"
299 column<float> col_filtered; ///< "filtered": % of rows filtered by condition
300 List<extra> col_extra; ///< "extra" column (traditional) or property list
301
302 // non-TRADITIONAL stuff:
303 mem_root_str col_message; ///< replaces "Extra" column if not empty
304 mem_root_str col_attached_condition; ///< former "Using where"
305
306 /// "rows": estimated number of examined table rows per single scan
308 /// "rows": estimated number of examined table rows per query
310
311 column<double> col_read_cost; ///< Time to read the table
312 /// Cost of the partial join including this table
314 /// Cost of evaluating conditions on this table per query
316
317 /// Size of data expected to be read per query
319
320 /// List of used columns
322
323 /// List of columns that can be updated using partial update.
325
326 /* For structured EXPLAIN in CTX_QEP_TAB context: */
327 uint query_block_id; ///< query block id for materialized subqueries
328
329 /**
330 List of "derived" subquery trees
331 */
333
334 List<const char> col_key_parts; ///< used parts of the key
335
341 /**
342 If a clone of a materialized derived table, this is the ID of the first
343 underlying query block of the first materialized derived table. 0
344 otherwise.
345 */
347
348 List<Window> *m_windows; ///< Windows to describe in this node
349
351 : query_block_id(0),
352 is_dependent(false),
353 is_cacheable(true),
354 using_temporary(false),
359
360 virtual ~qep_row() = default;
361
362 void cleanup() {
363 col_id.cleanup();
365 col_partitions.clear();
367 col_possible_keys.clear();
370 col_ref.clear();
371 col_filtered.cleanup();
372 col_extra.clear();
375 col_key_parts.clear();
376
377 col_rows.cleanup();
378 col_prefix_rows.cleanup();
379
380 col_read_cost.cleanup();
381 col_prefix_cost.cleanup();
382 col_cond_cost.cleanup();
383
385
386 /*
387 Not needed (we call cleanup() for structured EXPLAIN only,
388 just for the consistency).
389 */
390 query_block_id = 0;
391 derived_from.clear();
392 is_dependent = false;
393 is_cacheable = true;
394 using_temporary = false;
397 }
398
399 /**
400 Remember a subquery's unit
401
402 JOIN_TAB inside a JOIN, a table in a join-less query (single-table
403 UPDATE/DELETE) or a table that's optimized out may have a WHERE
404 condition. We create the Explain_context of such a JOIN_TAB or
405 table when the Explain_context objects of its in-WHERE subqueries
406 don't exist.
407 This function collects unit pointers of WHERE subqueries that are
408 associated with the current JOIN_TAB or table. Then we can match these
409 units with units of newly-created Explain_context objects of WHERE
410 subqueries.
411
412 @param subquery WHERE clause subquery's unit
413 */
415 [[maybe_unused]]) {}
416
418};
419
420/**
421 Enumeration of ORDER BY, GROUP BY and DISTINCT clauses for array indexing
422
423 See Explain_format_flags::sorts
424*/
432 //-----------------
433 ESC_MAX
435
436/**
437 Bit flags to explain GROUP BY, ORDER BY and DISTINCT clauses
438*/
441 ESP_EXISTS = 1 << 0, ///< Original query has this clause
442 ESP_IS_SIMPLE = 1 << 1, ///< Clause is effective for single JOIN_TAB only
443 ESP_USING_FILESORT = 1 << 2, ///< Clause causes a filesort
444 ESP_USING_TMPTABLE = 1 << 3, ///< Clause creates an intermediate table
445 ESP_DUPS_REMOVAL = 1 << 4 ///< Duplicate removal for DISTINCT
447
449 /**
450 Bitmasks of Explain_sort_property flags for Explain_sort_clause clauses
451 */
453
454 public:
455 Explain_format_flags() { memset(sorts, 0, sizeof(sorts)); }
456
457 /**
458 Set property bit flag for the clause
459 */
461 sorts[clause] |= property | ESP_EXISTS;
462 }
463
465 memcpy(sorts, flags.sorts, sizeof(sorts));
466 }
467
468 /**
469 Clear property bit flag for the clause
470 */
472 sorts[clause] &= ~property;
473 }
474
475 /**
476 Return true if property is set for the clause
477 */
478 bool get(Explain_sort_clause clause, Explain_sort_property property) const {
479 return sorts[clause] & property;
480 }
481
482 /**
483 Return true if any of clauses has this property set
484
485 @param property Check if this property is present in any of the sorts
486 except clause's sort if specified
487 @param clause Optional. Do not check for the property for this clause. The
488 default is to check all clauses.
489 */
491 Explain_sort_clause clause = ESC_none) const {
492 for (size_t i = ESC_none + 1; i <= ESC_MAX - 1; i++) {
493 if (i != clause && (sorts[i] & property)) return true;
494 }
495 return false;
496 }
497};
498
499/**
500 Base class for structured and hierarchical EXPLAIN output formatters
501*/
502
504 private:
505 /* Don't copy Explain_format values */
508
509 protected:
510 Query_result *output; ///< output resulting data there
511
512 public:
514 virtual ~Explain_format() = default;
515
516 /**
517 A hierarchical text or a plain table
518
519 @retval true Formatter produces hierarchical text
520 @retval false Traditional explain
521 */
522 virtual bool is_hierarchical() const = 0;
523
524 /**
525 Whether the format closely resembles the final plan to be executed by
526 execution iterators (See RowIterator). These formats share a common logic
527 that uses AccessPath structure to generate the information, so they all
528 display exactly the same information, even though the style of each format
529 might be different.
530
531 @note: The new json format for hypergraph and the tree format are examples
532 of iterator-based formats.
533
534 @retval true Format is Iterator-based.
535 @retval false Format is not Iterator-based.
536 */
537 virtual bool is_iterator_based() const { return false; }
538
539 /**
540 Send EXPLAIN header item(s) to output stream
541
542 @note: This function caches the output result set pointer for further use.
543
544 @param result output result set
545
546 @retval false OK
547 @retval true Error
548 */
550 output = result;
551 return false;
552 }
553
554 /**
555 Enter a specified context
556
557 @param context context type
558 @param subquery for CTX_WHERE: unit of the subquery
559 @param flags Format flags, see Explain_format_flags.
560 */
562 Query_expression *subquery = nullptr,
563 const Explain_format_flags *flags = nullptr) = 0;
564
565 /**
566 Leave the current context
567
568 @param context current context type (for validation/debugging)
569 */
570 virtual bool end_context(enum_parsing_context context) = 0;
571
572 /**
573 Flush TABLE/JOIN_TAB property set
574
575 For traditional EXPLAIN: output a single EXPLAIN row.
576 */
577 virtual bool flush_entry() = 0;
578
579 /**
580 Get a pointer to the current TABLE/JOIN_TAB property set
581 */
582 virtual qep_row *entry() = 0;
583
584 /**
585 Convert Json object to string. Should only be called for iterator-based
586 formats.
587 */
588 virtual std::string ExplainJsonToString(Json_object *json [[maybe_unused]]) {
589 assert(false);
590 return nullptr;
591 }
592};
593
594#endif // OPT_EXPLAIN_FORMAT_INCLUDED
Definition: opt_explain_format.h:448
bool get(Explain_sort_clause clause, Explain_sort_property property) const
Return true if property is set for the clause.
Definition: opt_explain_format.h:478
void set(Explain_format_flags &flags)
Definition: opt_explain_format.h:464
void reset(Explain_sort_clause clause, Explain_sort_property property)
Clear property bit flag for the clause.
Definition: opt_explain_format.h:471
bool any(Explain_sort_property property, Explain_sort_clause clause=ESC_none) const
Return true if any of clauses has this property set.
Definition: opt_explain_format.h:490
Explain_format_flags()
Definition: opt_explain_format.h:455
void set(Explain_sort_clause clause, Explain_sort_property property)
Set property bit flag for the clause.
Definition: opt_explain_format.h:460
uint8 sorts[ESC_MAX]
Bitmasks of Explain_sort_property flags for Explain_sort_clause clauses.
Definition: opt_explain_format.h:452
Base class for structured and hierarchical EXPLAIN output formatters.
Definition: opt_explain_format.h:503
Query_result * output
output resulting data there
Definition: opt_explain_format.h:510
virtual bool is_iterator_based() const
Whether the format closely resembles the final plan to be executed by execution iterators (See RowIte...
Definition: opt_explain_format.h:537
virtual std::string ExplainJsonToString(Json_object *json)
Convert Json object to string.
Definition: opt_explain_format.h:588
virtual bool flush_entry()=0
Flush TABLE/JOIN_TAB property set.
virtual bool end_context(enum_parsing_context context)=0
Leave the current context.
Explain_format & operator=(Explain_format &)
virtual ~Explain_format()=default
virtual qep_row * entry()=0
Get a pointer to the current TABLE/JOIN_TAB property set.
virtual bool is_hierarchical() const =0
A hierarchical text or a plain table.
virtual bool begin_context(enum_parsing_context context, Query_expression *subquery=nullptr, const Explain_format_flags *flags=nullptr)=0
Enter a specified context.
Explain_format()
Definition: opt_explain_format.h:513
virtual bool send_headers(Query_result *result)
Send EXPLAIN header item(s) to output stream.
Definition: opt_explain_format.h:549
Explain_format(Explain_format &)
Represents a JSON container value of type "object" (ECMA), type J_OBJECT here.
Definition: json_dom.h:372
Emulate lazy computation.
Definition: opt_explain_format.h:102
virtual ~Lazy()=default
virtual bool eval(String *ret)=0
Deferred evaluation of encapsulated expression.
Definition: sql_list.h:433
A JSON object (unordered set of key/value pairs).
Definition: opt_trace.h:798
This class represents a query expression (one query block or several query blocks combined with UNION...
Definition: sql_lex.h:622
Definition: query_result.h:53
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:166
const char * ptr() const
Definition: sql_string.h:248
size_t length() const
Definition: sql_string.h:240
Represents the (explicit) window of a SQL 2003 section 7.11 <window clause>, or the implicit (inlined...
Definition: window.h:104
Base class for all intermediate tree nodes.
Definition: opt_explain_json.cc:219
Helper class for table property buffering.
Definition: opt_explain_format.h:147
List< const char > col_partial_update_columns
List of columns that can be updated using partial update.
Definition: opt_explain_format.h:324
List< const char > col_partitions
"partitions" column
Definition: opt_explain_format.h:290
void format_extra(Opt_trace_object *obj)
Definition: opt_explain_json.cc:2091
mem_root_str col_message
replaces "Extra" column if not empty
Definition: opt_explain_format.h:303
List< extra > col_extra
"extra" column (traditional) or property list
Definition: opt_explain_format.h:300
void cleanup()
Definition: opt_explain_format.h:362
qep_row & operator=(const qep_row &x)
List< const char > col_possible_keys
"possible_keys": comma-separated list
Definition: opt_explain_format.h:293
mem_root_str col_attached_condition
former "Using where"
Definition: opt_explain_format.h:304
enum_mod_type mod_type
Definition: opt_explain_format.h:339
mem_root_str col_join_type
"type" column, see join_type_str array
Definition: opt_explain_format.h:291
mem_root_str col_key_len
"key_length" column: length of the "key" above
Definition: opt_explain_format.h:296
column< double > col_prefix_cost
Cost of the partial join including this table.
Definition: opt_explain_format.h:313
column< ulonglong > col_rows
"rows": estimated number of examined table rows per single scan
Definition: opt_explain_format.h:307
column< double > col_read_cost
Time to read the table.
Definition: opt_explain_format.h:311
column< float > col_filtered
"filtered": % of rows filtered by condition
Definition: opt_explain_format.h:299
List< const char > col_key_parts
used parts of the key
Definition: opt_explain_format.h:334
List< const char > col_used_columns
List of used columns.
Definition: opt_explain_format.h:321
column< uint > col_id
"id" column: seq. number of SELECT within the query
Definition: opt_explain_format.h:287
List< const char > col_ref
"ref":columns/constants which are compared to "key"
Definition: opt_explain_format.h:298
qep_row()
Definition: opt_explain_format.h:350
column< ulonglong > col_prefix_rows
"rows": estimated number of examined table rows per query
Definition: opt_explain_format.h:309
mem_root_str col_key
"key" column: index that is actually decided to use
Definition: opt_explain_format.h:295
bool using_temporary
Definition: opt_explain_format.h:338
virtual void register_where_subquery(Query_expression *subquery)
Remember a subquery's unit.
Definition: opt_explain_format.h:414
bool is_dependent
Definition: opt_explain_format.h:336
List< opt_explain_json_namespace::context > derived_from
List of "derived" subquery trees.
Definition: opt_explain_format.h:332
uint derived_clone_id
If a clone of a materialized derived table, this is the ID of the first underlying query block of the...
Definition: opt_explain_format.h:346
uint query_block_id
query block id for materialized subqueries
Definition: opt_explain_format.h:327
column< enum_explain_type > col_select_type
"select_type" column
Definition: opt_explain_format.h:288
bool is_cacheable
Definition: opt_explain_format.h:337
mem_root_str col_table_name
"table" to which the row of output refers
Definition: opt_explain_format.h:289
virtual ~qep_row()=default
column< double > col_cond_cost
Cost of evaluating conditions on this table per query.
Definition: opt_explain_format.h:315
List< Window > * m_windows
Windows to describe in this node.
Definition: opt_explain_format.h:348
qep_row(const qep_row &x)
bool is_materialized_from_subquery
Definition: opt_explain_format.h:340
mem_root_str col_data_size_query
Size of data expected to be read per query.
Definition: opt_explain_format.h:318
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:221
enum_explain_type
Query_block type enum.
Definition: sql_lex.h:1130
void * memdup_root(MEM_ROOT *root, const void *str, size_t len)
Definition: my_alloc.cc:290
static int flags[50]
Definition: hp_test1.cc:39
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
Header for compiler-dependent features.
Some integer typedefs for easier portability.
uint8_t uint8
Definition: my_inttypes.h:62
Common header for many mysys elements.
Definition: opt_explain_format.h:130
Extra_tag
Types of traditional "extra" column parts and property names for hierarchical.
Definition: opt_explain_format.h:59
@ ET_SKIP_RECORDS_IN_RANGE
Definition: opt_explain_format.h:92
@ ET_UNIQUE_ROW_NOT_FOUND
Definition: opt_explain_format.h:85
@ ET_RANGE_CHECKED_FOR_EACH_RECORD
Definition: opt_explain_format.h:65
@ ET_none
Definition: opt_explain_format.h:60
@ ET_USING_JOIN_BUFFER
Definition: opt_explain_format.h:83
@ ET_USING
Definition: opt_explain_format.h:64
@ ET_USING_INDEX_CONDITION
Definition: opt_explain_format.h:63
@ ET_total
Definition: opt_explain_format.h:96
@ ET_END_MATERIALIZE
Definition: opt_explain_format.h:81
@ ET_FIRST_MATCH
Definition: opt_explain_format.h:78
@ ET_USING_INDEX
Definition: opt_explain_format.h:70
@ ET_TABLE_FUNCTION
Definition: opt_explain_format.h:91
@ ET_USING_WHERE
Definition: opt_explain_format.h:67
@ ET_RECURSIVE
Definition: opt_explain_format.h:90
@ ET_SCAN
Definition: opt_explain_format.h:82
@ ET_BACKWARD_SCAN
Definition: opt_explain_format.h:89
@ ET_NOT_EXISTS
Definition: opt_explain_format.h:68
@ ET_MATERIALIZE
Definition: opt_explain_format.h:79
@ ET_USING_INDEX_FOR_GROUP_BY
Definition: opt_explain_format.h:72
@ ET_USING_MRR
Definition: opt_explain_format.h:69
@ ET_PUSHED_JOIN
Definition: opt_explain_format.h:87
@ ET_REMATERIALIZE
Definition: opt_explain_format.h:94
@ ET_FT_HINTS
Definition: opt_explain_format.h:88
@ ET_USING_INDEX_FOR_SKIP_SCAN
Definition: opt_explain_format.h:73
@ ET_IMPOSSIBLE_ON_CONDITION
Definition: opt_explain_format.h:86
@ ET_START_TEMPORARY
Definition: opt_explain_format.h:76
@ ET_LOOSESCAN
Definition: opt_explain_format.h:75
@ ET_USING_FILESORT
Definition: opt_explain_format.h:62
@ ET_DISTINCT
Definition: opt_explain_format.h:74
@ ET_USING_PUSHED_CONDITION
Definition: opt_explain_format.h:66
@ ET_USING_TEMPORARY
Definition: opt_explain_format.h:61
@ ET_CONST_ROW_NOT_FOUND
Definition: opt_explain_format.h:84
@ ET_FULL_SCAN_ON_NULL_KEY
Definition: opt_explain_format.h:71
@ ET_END_TEMPORARY
Definition: opt_explain_format.h:77
@ ET_USING_SECONDARY_ENGINE
Definition: opt_explain_format.h:93
@ ET_START_MATERIALIZE
Definition: opt_explain_format.h:80
enum_mod_type
Definition: opt_explain_format.h:135
@ MT_UPDATE
Definition: opt_explain_format.h:135
@ MT_REPLACE
Definition: opt_explain_format.h:135
@ MT_INSERT
Definition: opt_explain_format.h:135
@ MT_NONE
Definition: opt_explain_format.h:135
@ MT_DELETE
Definition: opt_explain_format.h:135
Explain_sort_clause
Enumeration of ORDER BY, GROUP BY and DISTINCT clauses for array indexing.
Definition: opt_explain_format.h:425
@ ESC_WINDOWING
Definition: opt_explain_format.h:431
@ ESC_ORDER_BY
Definition: opt_explain_format.h:427
@ ESC_DISTINCT
Definition: opt_explain_format.h:429
@ ESC_BUFFER_RESULT
Definition: opt_explain_format.h:430
@ ESC_MAX
Definition: opt_explain_format.h:433
@ ESC_GROUP_BY
Definition: opt_explain_format.h:428
@ ESC_none
Definition: opt_explain_format.h:426
Explain_sort_property
Bit flags to explain GROUP BY, ORDER BY and DISTINCT clauses.
Definition: opt_explain_format.h:439
@ ESP_DUPS_REMOVAL
Duplicate removal for DISTINCT.
Definition: opt_explain_format.h:445
@ ESP_EXISTS
Original query has this clause.
Definition: opt_explain_format.h:441
@ ESP_USING_FILESORT
Clause causes a filesort.
Definition: opt_explain_format.h:443
@ ESP_IS_SIMPLE
Clause is effective for single JOIN_TAB only.
Definition: opt_explain_format.h:442
@ ESP_none
Definition: opt_explain_format.h:440
@ ESP_USING_TMPTABLE
Clause creates an intermediate table.
Definition: opt_explain_format.h:444
enum_parsing_context
Names for different query parse tree parts.
Definition: parse_tree_node_base.h:57
struct result result
Definition: result.h:33
Our own string classes, used pervasively throughout the executor.
Base class for all EXPLAIN context descriptor classes.
Definition: opt_explain_format.h:123
enum_parsing_context type
type tag
Definition: opt_explain_format.h:124
Explain_context(enum_parsing_context type_arg)
Definition: opt_explain_format.h:126
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:82
void * Alloc(size_t length)
Allocate memory.
Definition: my_alloc.h:144
A wrapper for numeric table properties.
Definition: opt_explain_format.h:165
column()
Definition: opt_explain_format.h:172
bool nil
true if the column contains NULL
Definition: opt_explain_format.h:167
T get() const
Definition: opt_explain_format.h:179
void set(T value_arg)
Definition: opt_explain_format.h:175
T value
Definition: opt_explain_format.h:169
bool is_empty() const
Definition: opt_explain_format.h:173
void cleanup()
Definition: opt_explain_format.h:174
Part of traditional "extra" column or related hierarchical property.
Definition: opt_explain_format.h:264
extra(Extra_tag tag_arg, const char *data_arg=nullptr)
Definition: opt_explain_format.h:277
const Extra_tag tag
A property name or a constant text head of the "extra" column part.
Definition: opt_explain_format.h:268
const char *const data
Property value or a variable tail of the "extra" column part.
Definition: opt_explain_format.h:275
Helper class to keep string data in MEM_ROOT before passing to Item_string.
Definition: opt_explain_format.h:197
size_t length
Definition: opt_explain_format.h:199
void cleanup()
Definition: opt_explain_format.h:204
void set_const(const char *str_arg, size_t length_arg)
Definition: opt_explain_format.h:241
bool set(const char *str_arg)
Definition: opt_explain_format.h:210
void set_const(const char *str_arg)
Make a copy of string constant.
Definition: opt_explain_format.h:238
void set(Lazy *x)
Save expression for further evaluation.
Definition: opt_explain_format.h:227
static char * strndup_root(MEM_ROOT *root, const char *str, size_t len)
Definition: opt_explain_format.h:247
Lazy * deferred
encapsulated expression to evaluate it later (on demand)
Definition: opt_explain_format.h:201
bool is_empty()
Definition: opt_explain_format.cc:31
mem_root_str()
Definition: opt_explain_format.h:203
const char * str
Definition: opt_explain_format.h:198
bool set(const String &s)
Definition: opt_explain_format.h:211
Definition: result.h:29
unsigned int uint
Definition: uca9-dump.cc:74