-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
opt_explain.h
executable file
·77 lines (57 loc) · 2.85 KB
/
opt_explain.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef OPT_EXPLAIN_INCLUDED
#define OPT_EXPLAIN_INCLUDED
/** @file "EXPLAIN <command>"
Single table UPDATE/DELETE commands are explained by the
explain_single_table_modification() function.
A query expression (complete SELECT query possibly including
subqueries and unions), INSERT...SELECT and multitable UPDATE/DELETE
commands are explained like this:
(1) explain_query_expression()
Is the entry point. Forwards the job to explain_unit().
(2) explain_unit()
Is for a SELECT_LEX_UNIT, prepares, optimizes, explains one JOIN for
each "top-level" SELECT_LEXs of the unit (like: all SELECTs of a
UNION; but not subqueries), and one JOIN for the fake SELECT_LEX of
UNION); each JOIN explain (JOIN::exec()) calls explain_query_specification()
(3) explain_query_specification()
Is for a single SELECT_LEX (fake or not). It needs a prepared and
optimized JOIN, for which it builds the EXPLAIN rows. But it also
launches the EXPLAIN process for "inner units" (==subqueries of this
SELECT_LEX), by calling explain_unit() for each of them.
*/
#include <my_base.h>
class JOIN;
class select_result;
class select_result_interceptor;
class SQL_SELECT;
struct TABLE;
class THD;
extern const char *join_type_str[];
bool explain_no_table(THD *thd, JOIN *join, const char *message);
bool explain_no_table(THD *thd, const char *message,
ha_rows rows= HA_POS_ERROR);
bool explain_single_table_modification(THD *thd,
TABLE *table,
const SQL_SELECT *select,
uint key,
ha_rows limit,
bool need_tmp_table,
bool need_sort,
bool is_update,
bool used_key_is_modified= false);
bool explain_query_specification(THD *thd, JOIN *join);
bool explain_multi_table_modification(THD *thd,
select_result_interceptor *result);
bool explain_query_expression(THD *thd, select_result *result);
#endif /* OPT_EXPLAIN_INCLUDED */