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