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