MySQL 8.0.30
Source Code Documentation
opt_explain_format.h
Go to the documentation of this file.
1/* Copyright (c) 2011, 2022, 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;
49
50enum class enum_explain_type;
51
52/**
53 Types of traditional "extra" column parts and property names for hierarchical
54
55 The traditional_extra_tags[] and json_extra_tags[] arrays must be in sync
56 with this enum.
57*/
94 //------------------------------------
96};
97
98/**
99 Emulate lazy computation
100*/
101class Lazy {
102 public:
103 virtual ~Lazy() = default;
104
105 /**
106 Deferred evaluation of encapsulated expression
107
108 @param [out] ret Return string value
109
110 @retval false Success
111 @retval true Failure (OOM)
112 */
113 virtual bool eval(String *ret) = 0;
114};
115
116/**
117 Base class for all EXPLAIN context descriptor classes
118
119 In structured EXPLAIN implementation Explain_context is a base class for
120 notes of an intermediate tree.
121*/
124
125 explicit Explain_context(enum_parsing_context type_arg) : type(type_arg) {}
126};
127
128namespace opt_explain_json_namespace // for forward declaration of "context"
129{
130class context;
131}
132
133// Table modification type
135
136/**
137 Helper class for table property buffering
138
139 For traditional EXPLAIN this structure contains cached data for a single
140 output row.
141
142 For hierarchical EXPLAIN this structure contains property values for a single
143 CTX_TABLE/CTX_QEP_TAB context node of the intermediate tree.
144*/
145
146class qep_row {
147 private:
148 /* Don't copy this structure */
149 explicit qep_row(const qep_row &x); // undefined
150 qep_row &operator=(const qep_row &x); // undefined
151
152 public:
153 /**
154 A wrapper for numeric table properties
155
156 For traditional EXPLAIN this structure contains a value of one cell of the
157 output row (excluding textual column values - see mem_root_str, and
158 "Extra" column - see the col_extra list).
159
160 For hierarchical EXPLAIN this structure contains a numeric property value
161 for a single CTX_TABLE/CTX_QEP_TAB context node of the intermediate tree.
162 */
163 template <typename T>
164 struct column {
165 private:
166 bool nil; ///< true if the column contains NULL
167 public:
169
170 public:
172 bool is_empty() const { return nil; }
173 void cleanup() { nil = true; }
174 void set(T value_arg) {
175 value = value_arg;
176 nil = false;
177 }
178 T get() const {
179 assert(!nil);
180 return value;
181 }
182 };
183
184 /**
185 Helper class to keep string data in MEM_ROOT before passing to Item_string
186
187 Since Item_string constructors doesn't copy input string parameter data
188 in the most cases, those input strings must have the same lifetime as
189 Item_string objects, i.e. lifetime of MEM_ROOT.
190 This class allocates input parameters for Item_string objects in MEM_ROOT.
191
192 @note Call to is_empty() is necessary before the access to "str" and
193 "length" fields, since is_empty() may trigger an evaluation of
194 an associated expression that updates these fields.
195 */
197 const char *str;
198 size_t length;
199 Lazy *
200 deferred; ///< encapsulated expression to evaluate it later (on demand)
201
203 void cleanup() {
204 str = nullptr;
205 length = 0;
206 deferred = nullptr;
207 }
208 bool is_empty();
209 bool set(const char *str_arg) { return set(str_arg, strlen(str_arg)); }
210 bool set(const String &s) { return set(s.ptr(), s.length()); }
211 /**
212 Make a copy of the string in MEM_ROOT
213
214 @param str_arg string to copy
215 @param length_arg input string length
216
217 @return false if success, true if error
218 */
219 bool set(const char *str_arg, size_t length_arg);
220
221 /**
222 Save expression for further evaluation
223
224 @param x Expression
225 */
226 void set(Lazy *x) {
227 deferred = x;
228 str = nullptr;
229 length = 0;
230 }
231 /**
232 Make a copy of string constant
233
234 Variant of set() usable when the str_arg argument lives longer
235 than the mem_root_str instance.
236 */
237 void set_const(const char *str_arg) {
238 return set_const(str_arg, strlen(str_arg));
239 }
240 void set_const(const char *str_arg, size_t length_arg) {
241 deferred = nullptr;
242 str = str_arg;
243 length = length_arg;
244 }
245
246 static char *strndup_root(MEM_ROOT *root, const char *str, size_t len) {
247 if (len == 0 || str == nullptr) return const_cast<char *>("");
248 if (str[len - 1] == 0)
249 return static_cast<char *>(memdup_root(root, str, len));
250
251 char *ret = static_cast<char *>(root->Alloc(len + 1));
252 if (ret != nullptr) {
253 memcpy(ret, str, len);
254 ret[len] = 0;
255 }
256 return ret;
257 }
258 };
259
260 /**
261 Part of traditional "extra" column or related hierarchical property
262 */
263 struct extra {
264 /**
265 A property name or a constant text head of the "extra" column part
266 */
268 /**
269 Property value or a variable tail of the "extra" column part
270
271 If data == NULL, hierarchical formatter outputs a boolean property
272 value of "true".
273 */
274 const char *const data;
275
276 explicit extra(Extra_tag tag_arg, const char *data_arg = nullptr)
277 : tag(tag_arg), data(data_arg) {}
278 };
279
280 /*
281 Next "col_*" fields are intended to be filling by "explain_*()" functions.
282
283 NOTE: NULL value or mem_root_str.is_empty()==true means that Item_null
284 object will be pushed into "items" list instead.
285 */
286 column<uint>
287 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 virtual bool is_tree() const { return false; }
525
526 /**
527 Send EXPLAIN header item(s) to output stream
528
529 @note: This function caches the output result set pointer for further use.
530
531 @param result output result set
532
533 @retval false OK
534 @retval true Error
535 */
537 output = result;
538 return false;
539 }
540
541 /**
542 Enter a specified context
543
544 @param context context type
545 @param subquery for CTX_WHERE: unit of the subquery
546 @param flags Format flags, see Explain_format_flags.
547 */
549 Query_expression *subquery = nullptr,
550 const Explain_format_flags *flags = nullptr) = 0;
551
552 /**
553 Leave the current context
554
555 @param context current context type (for validation/debugging)
556 */
557 virtual bool end_context(enum_parsing_context context) = 0;
558
559 /**
560 Flush TABLE/JOIN_TAB property set
561
562 For traditional EXPLAIN: output a single EXPLAIN row.
563 */
564 virtual bool flush_entry() = 0;
565
566 /**
567 Get a pointer to the current TABLE/JOIN_TAB property set
568 */
569 virtual qep_row *entry() = 0;
570};
571
572#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 flush_entry()=0
Flush TABLE/JOIN_TAB property set.
virtual bool end_context(enum_parsing_context context)=0
Leave the current context.
virtual bool is_tree() const
Definition: opt_explain_format.h:524
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:536
Explain_format(Explain_format &)
Emulate lazy computation.
Definition: opt_explain_format.h:101
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:801
This class represents a query expression (one query block or several query blocks combined with UNION...
Definition: sql_lex.h:629
Definition: query_result.h:51
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:215
Helper class for table property buffering.
Definition: opt_explain_format.h:146
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:2027
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:1104
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:129
Extra_tag
Types of traditional "extra" column parts and property names for hierarchical.
Definition: opt_explain_format.h:58
@ ET_SKIP_RECORDS_IN_RANGE
Definition: opt_explain_format.h:91
@ ET_UNIQUE_ROW_NOT_FOUND
Definition: opt_explain_format.h:84
@ ET_RANGE_CHECKED_FOR_EACH_RECORD
Definition: opt_explain_format.h:64
@ ET_none
Definition: opt_explain_format.h:59
@ ET_USING_JOIN_BUFFER
Definition: opt_explain_format.h:82
@ ET_USING
Definition: opt_explain_format.h:63
@ ET_USING_INDEX_CONDITION
Definition: opt_explain_format.h:62
@ ET_total
Definition: opt_explain_format.h:95
@ ET_END_MATERIALIZE
Definition: opt_explain_format.h:80
@ ET_FIRST_MATCH
Definition: opt_explain_format.h:77
@ ET_USING_INDEX
Definition: opt_explain_format.h:69
@ ET_TABLE_FUNCTION
Definition: opt_explain_format.h:90
@ ET_USING_WHERE
Definition: opt_explain_format.h:66
@ ET_RECURSIVE
Definition: opt_explain_format.h:89
@ ET_SCAN
Definition: opt_explain_format.h:81
@ ET_BACKWARD_SCAN
Definition: opt_explain_format.h:88
@ ET_NOT_EXISTS
Definition: opt_explain_format.h:67
@ ET_MATERIALIZE
Definition: opt_explain_format.h:78
@ ET_USING_INDEX_FOR_GROUP_BY
Definition: opt_explain_format.h:71
@ ET_USING_MRR
Definition: opt_explain_format.h:68
@ ET_PUSHED_JOIN
Definition: opt_explain_format.h:86
@ ET_REMATERIALIZE
Definition: opt_explain_format.h:93
@ ET_FT_HINTS
Definition: opt_explain_format.h:87
@ ET_USING_INDEX_FOR_SKIP_SCAN
Definition: opt_explain_format.h:72
@ ET_IMPOSSIBLE_ON_CONDITION
Definition: opt_explain_format.h:85
@ ET_START_TEMPORARY
Definition: opt_explain_format.h:75
@ ET_LOOSESCAN
Definition: opt_explain_format.h:74
@ ET_USING_FILESORT
Definition: opt_explain_format.h:61
@ ET_DISTINCT
Definition: opt_explain_format.h:73
@ ET_USING_PUSHED_CONDITION
Definition: opt_explain_format.h:65
@ ET_USING_TEMPORARY
Definition: opt_explain_format.h:60
@ ET_CONST_ROW_NOT_FOUND
Definition: opt_explain_format.h:83
@ ET_FULL_SCAN_ON_NULL_KEY
Definition: opt_explain_format.h:70
@ ET_END_TEMPORARY
Definition: opt_explain_format.h:76
@ ET_USING_SECONDARY_ENGINE
Definition: opt_explain_format.h:92
@ ET_START_MATERIALIZE
Definition: opt_explain_format.h:79
enum_mod_type
Definition: opt_explain_format.h:134
@ MT_UPDATE
Definition: opt_explain_format.h:134
@ MT_REPLACE
Definition: opt_explain_format.h:134
@ MT_INSERT
Definition: opt_explain_format.h:134
@ MT_NONE
Definition: opt_explain_format.h:134
@ MT_DELETE
Definition: opt_explain_format.h:134
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:55
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:122
enum_parsing_context type
type tag
Definition: opt_explain_format.h:123
Explain_context(enum_parsing_context type_arg)
Definition: opt_explain_format.h:125
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:164
column()
Definition: opt_explain_format.h:171
bool nil
true if the column contains NULL
Definition: opt_explain_format.h:166
T get() const
Definition: opt_explain_format.h:178
void set(T value_arg)
Definition: opt_explain_format.h:174
T value
Definition: opt_explain_format.h:168
bool is_empty() const
Definition: opt_explain_format.h:172
void cleanup()
Definition: opt_explain_format.h:173
Part of traditional "extra" column or related hierarchical property.
Definition: opt_explain_format.h:263
extra(Extra_tag tag_arg, const char *data_arg=nullptr)
Definition: opt_explain_format.h:276
const Extra_tag tag
A property name or a constant text head of the "extra" column part.
Definition: opt_explain_format.h:267
const char *const data
Property value or a variable tail of the "extra" column part.
Definition: opt_explain_format.h:274
Helper class to keep string data in MEM_ROOT before passing to Item_string.
Definition: opt_explain_format.h:196
size_t length
Definition: opt_explain_format.h:198
void cleanup()
Definition: opt_explain_format.h:203
void set_const(const char *str_arg, size_t length_arg)
Definition: opt_explain_format.h:240
bool set(const char *str_arg)
Definition: opt_explain_format.h:209
void set_const(const char *str_arg)
Make a copy of string constant.
Definition: opt_explain_format.h:237
void set(Lazy *x)
Save expression for further evaluation.
Definition: opt_explain_format.h:226
static char * strndup_root(MEM_ROOT *root, const char *str, size_t len)
Definition: opt_explain_format.h:246
Lazy * deferred
encapsulated expression to evaluate it later (on demand)
Definition: opt_explain_format.h:200
bool is_empty()
Definition: opt_explain_format.cc:31
mem_root_str()
Definition: opt_explain_format.h:202
const char * str
Definition: opt_explain_format.h:197
bool set(const String &s)
Definition: opt_explain_format.h:210
Definition: result.h:29
unsigned int uint
Definition: uca-dump.cc:29