Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
72bc6d73
Commit
72bc6d73
authored
Oct 05, 2013
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-3798: EXPLAIN UPDATE/DELETE
- Address review feedback: more renames
parent
6a7f8af3
Changes
10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
173 additions
and
167 deletions
+173
-167
sql/opt_range.cc
sql/opt_range.cc
+22
-21
sql/opt_range.h
sql/opt_range.h
+7
-7
sql/sql_delete.cc
sql/sql_delete.cc
+33
-31
sql/sql_explain.cc
sql/sql_explain.cc
+9
-6
sql/sql_explain.h
sql/sql_explain.h
+6
-6
sql/sql_join_cache.cc
sql/sql_join_cache.cc
+12
-12
sql/sql_join_cache.h
sql/sql_join_cache.h
+3
-3
sql/sql_lex.cc
sql/sql_lex.cc
+6
-6
sql/sql_lex.h
sql/sql_lex.h
+2
-2
sql/sql_select.cc
sql/sql_select.cc
+73
-73
No files found.
sql/opt_range.cc
View file @
72bc6d73
...
@@ -11940,25 +11940,26 @@ void QUICK_SELECT_I::add_key_name(String *str, bool *first)
...
@@ -11940,25 +11940,26 @@ void QUICK_SELECT_I::add_key_name(String *str, bool *first)
}
}
void
QUICK_RANGE_SELECT
::
save_info
(
MEM_ROOT
*
alloc
,
Explain_quick_select
*
qpf
)
void
QUICK_RANGE_SELECT
::
save_info
(
MEM_ROOT
*
alloc
,
Explain_quick_select
*
explain
)
{
{
qpf
->
quick_type
=
QS_TYPE_RANGE
;
explain
->
quick_type
=
QS_TYPE_RANGE
;
qpf
->
range
.
set
(
alloc
,
head
->
key_info
[
index
].
name
,
max_used_key_length
);
explain
->
range
.
set
(
alloc
,
head
->
key_info
[
index
].
name
,
max_used_key_length
);
}
}
void
QUICK_GROUP_MIN_MAX_SELECT
::
save_info
(
MEM_ROOT
*
alloc
,
void
QUICK_GROUP_MIN_MAX_SELECT
::
save_info
(
MEM_ROOT
*
alloc
,
Explain_quick_select
*
qpf
)
Explain_quick_select
*
explain
)
{
{
qpf
->
quick_type
=
QS_TYPE_GROUP_MIN_MAX
;
explain
->
quick_type
=
QS_TYPE_GROUP_MIN_MAX
;
qpf
->
range
.
set
(
alloc
,
head
->
key_info
[
index
].
name
,
max_used_key_length
);
explain
->
range
.
set
(
alloc
,
head
->
key_info
[
index
].
name
,
max_used_key_length
);
}
}
void
QUICK_INDEX_SORT_SELECT
::
save_info
(
MEM_ROOT
*
alloc
,
void
QUICK_INDEX_SORT_SELECT
::
save_info
(
MEM_ROOT
*
alloc
,
Explain_quick_select
*
qpf
)
Explain_quick_select
*
explain
)
{
{
qpf
->
quick_type
=
get_type
();
explain
->
quick_type
=
get_type
();
QUICK_RANGE_SELECT
*
quick
;
QUICK_RANGE_SELECT
*
quick
;
Explain_quick_select
*
child_qpf
;
Explain_quick_select
*
child_qpf
;
...
@@ -11966,14 +11967,14 @@ void QUICK_INDEX_SORT_SELECT::save_info(MEM_ROOT *alloc,
...
@@ -11966,14 +11967,14 @@ void QUICK_INDEX_SORT_SELECT::save_info(MEM_ROOT *alloc,
while
((
quick
=
it
++
))
while
((
quick
=
it
++
))
{
{
child_qpf
=
new
Explain_quick_select
;
child_qpf
=
new
Explain_quick_select
;
qpf
->
children
.
push_back
(
child_qpf
);
explain
->
children
.
push_back
(
child_qpf
);
quick
->
save_info
(
alloc
,
child_qpf
);
quick
->
save_info
(
alloc
,
child_qpf
);
}
}
if
(
pk_quick_select
)
if
(
pk_quick_select
)
{
{
child_qpf
=
new
Explain_quick_select
;
child_qpf
=
new
Explain_quick_select
;
qpf
->
children
.
push_back
(
child_qpf
);
explain
->
children
.
push_back
(
child_qpf
);
pk_quick_select
->
save_info
(
alloc
,
child_qpf
);
pk_quick_select
->
save_info
(
alloc
,
child_qpf
);
}
}
}
}
...
@@ -11983,15 +11984,15 @@ void QUICK_INDEX_SORT_SELECT::save_info(MEM_ROOT *alloc,
...
@@ -11983,15 +11984,15 @@ void QUICK_INDEX_SORT_SELECT::save_info(MEM_ROOT *alloc,
first
first
*/
*/
void
QUICK_INDEX_INTERSECT_SELECT
::
save_info
(
MEM_ROOT
*
alloc
,
void
QUICK_INDEX_INTERSECT_SELECT
::
save_info
(
MEM_ROOT
*
alloc
,
Explain_quick_select
*
qpf
)
Explain_quick_select
*
explain
)
{
{
qpf
->
quick_type
=
get_type
();
explain
->
quick_type
=
get_type
();
Explain_quick_select
*
child_qpf
;
Explain_quick_select
*
child_qpf
;
if
(
pk_quick_select
)
if
(
pk_quick_select
)
{
{
child_qpf
=
new
Explain_quick_select
;
child_qpf
=
new
Explain_quick_select
;
qpf
->
children
.
push_back
(
child_qpf
);
explain
->
children
.
push_back
(
child_qpf
);
pk_quick_select
->
save_info
(
alloc
,
child_qpf
);
pk_quick_select
->
save_info
(
alloc
,
child_qpf
);
}
}
...
@@ -12000,7 +12001,7 @@ void QUICK_INDEX_INTERSECT_SELECT::save_info(MEM_ROOT *alloc,
...
@@ -12000,7 +12001,7 @@ void QUICK_INDEX_INTERSECT_SELECT::save_info(MEM_ROOT *alloc,
while
((
quick
=
it
++
))
while
((
quick
=
it
++
))
{
{
child_qpf
=
new
Explain_quick_select
;
child_qpf
=
new
Explain_quick_select
;
qpf
->
children
.
push_back
(
child_qpf
);
explain
->
children
.
push_back
(
child_qpf
);
quick
->
save_info
(
alloc
,
child_qpf
);
quick
->
save_info
(
alloc
,
child_qpf
);
}
}
...
@@ -12008,39 +12009,39 @@ void QUICK_INDEX_INTERSECT_SELECT::save_info(MEM_ROOT *alloc,
...
@@ -12008,39 +12009,39 @@ void QUICK_INDEX_INTERSECT_SELECT::save_info(MEM_ROOT *alloc,
void
QUICK_ROR_INTERSECT_SELECT
::
save_info
(
MEM_ROOT
*
alloc
,
void
QUICK_ROR_INTERSECT_SELECT
::
save_info
(
MEM_ROOT
*
alloc
,
Explain_quick_select
*
qpf
)
Explain_quick_select
*
explain
)
{
{
qpf
->
quick_type
=
get_type
();
explain
->
quick_type
=
get_type
();
QUICK_SELECT_WITH_RECORD
*
qr
;
QUICK_SELECT_WITH_RECORD
*
qr
;
List_iterator_fast
<
QUICK_SELECT_WITH_RECORD
>
it
(
quick_selects
);
List_iterator_fast
<
QUICK_SELECT_WITH_RECORD
>
it
(
quick_selects
);
while
((
qr
=
it
++
))
while
((
qr
=
it
++
))
{
{
Explain_quick_select
*
child_qpf
=
new
Explain_quick_select
;
Explain_quick_select
*
child_qpf
=
new
Explain_quick_select
;
qpf
->
children
.
push_back
(
child_qpf
);
explain
->
children
.
push_back
(
child_qpf
);
qr
->
quick
->
save_info
(
alloc
,
child_qpf
);
qr
->
quick
->
save_info
(
alloc
,
child_qpf
);
}
}
if
(
cpk_quick
)
if
(
cpk_quick
)
{
{
Explain_quick_select
*
child_qpf
=
new
Explain_quick_select
;
Explain_quick_select
*
child_qpf
=
new
Explain_quick_select
;
qpf
->
children
.
push_back
(
child_qpf
);
explain
->
children
.
push_back
(
child_qpf
);
cpk_quick
->
save_info
(
alloc
,
child_qpf
);
cpk_quick
->
save_info
(
alloc
,
child_qpf
);
}
}
}
}
void
QUICK_ROR_UNION_SELECT
::
save_info
(
MEM_ROOT
*
alloc
,
void
QUICK_ROR_UNION_SELECT
::
save_info
(
MEM_ROOT
*
alloc
,
Explain_quick_select
*
qpf
)
Explain_quick_select
*
explain
)
{
{
qpf
->
quick_type
=
get_type
();
explain
->
quick_type
=
get_type
();
QUICK_SELECT_I
*
quick
;
QUICK_SELECT_I
*
quick
;
List_iterator_fast
<
QUICK_SELECT_I
>
it
(
quick_selects
);
List_iterator_fast
<
QUICK_SELECT_I
>
it
(
quick_selects
);
while
((
quick
=
it
++
))
while
((
quick
=
it
++
))
{
{
Explain_quick_select
*
child_qpf
=
new
Explain_quick_select
;
Explain_quick_select
*
child_qpf
=
new
Explain_quick_select
;
qpf
->
children
.
push_back
(
child_qpf
);
explain
->
children
.
push_back
(
child_qpf
);
quick
->
save_info
(
alloc
,
child_qpf
);
quick
->
save_info
(
alloc
,
child_qpf
);
}
}
}
}
...
...
sql/opt_range.h
View file @
72bc6d73
...
@@ -346,7 +346,7 @@ public:
...
@@ -346,7 +346,7 @@ public:
void
add_key_name
(
String
*
str
,
bool
*
first
);
void
add_key_name
(
String
*
str
,
bool
*
first
);
/* Save information about quick select's query plan */
/* Save information about quick select's query plan */
virtual
void
save_info
(
MEM_ROOT
*
alloc
,
Explain_quick_select
*
qpf
)
=
0
;
virtual
void
save_info
(
MEM_ROOT
*
alloc
,
Explain_quick_select
*
explain
)
=
0
;
/*
/*
Return 1 if any index used by this quick select
Return 1 if any index used by this quick select
...
@@ -473,7 +473,7 @@ public:
...
@@ -473,7 +473,7 @@ public:
{
file
->
position
(
record
);
}
{
file
->
position
(
record
);
}
int
get_type
()
{
return
QS_TYPE_RANGE
;
}
int
get_type
()
{
return
QS_TYPE_RANGE
;
}
void
add_keys_and_lengths
(
String
*
key_names
,
String
*
used_lengths
);
void
add_keys_and_lengths
(
String
*
key_names
,
String
*
used_lengths
);
void
save_info
(
MEM_ROOT
*
alloc
,
Explain_quick_select
*
qpf
);
void
save_info
(
MEM_ROOT
*
alloc
,
Explain_quick_select
*
explain
);
#ifndef DBUG_OFF
#ifndef DBUG_OFF
void
dbug_dump
(
int
indent
,
bool
verbose
);
void
dbug_dump
(
int
indent
,
bool
verbose
);
#endif
#endif
...
@@ -610,7 +610,7 @@ public:
...
@@ -610,7 +610,7 @@ public:
#ifndef DBUG_OFF
#ifndef DBUG_OFF
void
dbug_dump
(
int
indent
,
bool
verbose
);
void
dbug_dump
(
int
indent
,
bool
verbose
);
#endif
#endif
void
save_info
(
MEM_ROOT
*
alloc
,
Explain_quick_select
*
qpf
);
void
save_info
(
MEM_ROOT
*
alloc
,
Explain_quick_select
*
explain
);
bool
push_quick_back
(
QUICK_RANGE_SELECT
*
quick_sel_range
);
bool
push_quick_back
(
QUICK_RANGE_SELECT
*
quick_sel_range
);
...
@@ -674,7 +674,7 @@ public:
...
@@ -674,7 +674,7 @@ public:
int
get_next
();
int
get_next
();
int
get_type
()
{
return
QS_TYPE_INDEX_INTERSECT
;
}
int
get_type
()
{
return
QS_TYPE_INDEX_INTERSECT
;
}
void
add_keys_and_lengths
(
String
*
key_names
,
String
*
used_lengths
);
void
add_keys_and_lengths
(
String
*
key_names
,
String
*
used_lengths
);
void
save_info
(
MEM_ROOT
*
alloc
,
Explain_quick_select
*
qpf
);
void
save_info
(
MEM_ROOT
*
alloc
,
Explain_quick_select
*
explain
);
};
};
...
@@ -712,7 +712,7 @@ public:
...
@@ -712,7 +712,7 @@ public:
bool
unique_key_range
()
{
return
false
;
}
bool
unique_key_range
()
{
return
false
;
}
int
get_type
()
{
return
QS_TYPE_ROR_INTERSECT
;
}
int
get_type
()
{
return
QS_TYPE_ROR_INTERSECT
;
}
void
add_keys_and_lengths
(
String
*
key_names
,
String
*
used_lengths
);
void
add_keys_and_lengths
(
String
*
key_names
,
String
*
used_lengths
);
void
save_info
(
MEM_ROOT
*
alloc
,
Explain_quick_select
*
qpf
);
void
save_info
(
MEM_ROOT
*
alloc
,
Explain_quick_select
*
explain
);
bool
is_keys_used
(
const
MY_BITMAP
*
fields
);
bool
is_keys_used
(
const
MY_BITMAP
*
fields
);
#ifndef DBUG_OFF
#ifndef DBUG_OFF
void
dbug_dump
(
int
indent
,
bool
verbose
);
void
dbug_dump
(
int
indent
,
bool
verbose
);
...
@@ -791,7 +791,7 @@ public:
...
@@ -791,7 +791,7 @@ public:
bool
unique_key_range
()
{
return
false
;
}
bool
unique_key_range
()
{
return
false
;
}
int
get_type
()
{
return
QS_TYPE_ROR_UNION
;
}
int
get_type
()
{
return
QS_TYPE_ROR_UNION
;
}
void
add_keys_and_lengths
(
String
*
key_names
,
String
*
used_lengths
);
void
add_keys_and_lengths
(
String
*
key_names
,
String
*
used_lengths
);
void
save_info
(
MEM_ROOT
*
alloc
,
Explain_quick_select
*
qpf
);
void
save_info
(
MEM_ROOT
*
alloc
,
Explain_quick_select
*
explain
);
bool
is_keys_used
(
const
MY_BITMAP
*
fields
);
bool
is_keys_used
(
const
MY_BITMAP
*
fields
);
#ifndef DBUG_OFF
#ifndef DBUG_OFF
void
dbug_dump
(
int
indent
,
bool
verbose
);
void
dbug_dump
(
int
indent
,
bool
verbose
);
...
@@ -940,7 +940,7 @@ public:
...
@@ -940,7 +940,7 @@ public:
#endif
#endif
bool
is_agg_distinct
()
{
return
have_agg_distinct
;
}
bool
is_agg_distinct
()
{
return
have_agg_distinct
;
}
bool
loose_scan_is_scanning
()
{
return
is_index_scan
;
}
bool
loose_scan_is_scanning
()
{
return
is_index_scan
;
}
void
save_info
(
MEM_ROOT
*
alloc
,
Explain_quick_select
*
qpf
);
void
save_info
(
MEM_ROOT
*
alloc
,
Explain_quick_select
*
explain
);
};
};
...
...
sql/sql_delete.cc
View file @
72bc6d73
...
@@ -53,59 +53,60 @@
...
@@ -53,59 +53,60 @@
void
Delete_plan
::
save_explain_data
(
Explain_query
*
query
)
void
Delete_plan
::
save_explain_data
(
Explain_query
*
query
)
{
{
QPF_delete
*
qpf
=
new
QPF
_delete
;
Explain_delete
*
explain
=
new
Explain
_delete
;
if
(
deleting_all_rows
)
if
(
deleting_all_rows
)
{
{
qpf
->
deleting_all_rows
=
true
;
explain
->
deleting_all_rows
=
true
;
qpf
->
select_type
=
"SIMPLE"
;
explain
->
select_type
=
"SIMPLE"
;
}
}
else
else
{
{
qpf
->
deleting_all_rows
=
false
;
explain
->
deleting_all_rows
=
false
;
Update_plan
::
save_explain_data_intern
(
query
,
qpf
);
Update_plan
::
save_explain_data_intern
(
query
,
explain
);
}
}
query
->
upd_del_plan
=
qpf
;
query
->
upd_del_plan
=
explain
;
}
}
void
Update_plan
::
save_explain_data
(
Explain_query
*
query
)
void
Update_plan
::
save_explain_data
(
Explain_query
*
query
)
{
{
QPF_update
*
qpf
=
new
QPF
_update
;
Explain_update
*
explain
=
new
Explain
_update
;
save_explain_data_intern
(
query
,
qpf
);
save_explain_data_intern
(
query
,
explain
);
query
->
upd_del_plan
=
qpf
;
query
->
upd_del_plan
=
explain
;
}
}
void
Update_plan
::
save_explain_data_intern
(
Explain_query
*
query
,
QPF_update
*
qpf
)
void
Update_plan
::
save_explain_data_intern
(
Explain_query
*
query
,
Explain_update
*
explain
)
{
{
qpf
->
select_type
=
"SIMPLE"
;
explain
->
select_type
=
"SIMPLE"
;
qpf
->
table_name
.
append
(
table
->
pos_in_table_list
->
alias
);
explain
->
table_name
.
append
(
table
->
pos_in_table_list
->
alias
);
if
(
impossible_where
)
if
(
impossible_where
)
{
{
qpf
->
impossible_where
=
true
;
explain
->
impossible_where
=
true
;
return
;
return
;
}
}
qpf
->
impossible_where
=
false
;
explain
->
impossible_where
=
false
;
select_lex
->
set_explain_type
(
TRUE
);
select_lex
->
set_explain_type
(
TRUE
);
qpf
->
select_type
=
select_lex
->
type
;
explain
->
select_type
=
select_lex
->
type
;
/* Partitions */
/* Partitions */
{
{
#ifdef WITH_PARTITION_STORAGE_ENGINE
#ifdef WITH_PARTITION_STORAGE_ENGINE
partition_info
*
part_info
;
partition_info
*
part_info
;
if
((
part_info
=
table
->
part_info
))
if
((
part_info
=
table
->
part_info
))
{
{
make_used_partitions_str
(
part_info
,
&
qpf
->
used_partitions
);
make_used_partitions_str
(
part_info
,
&
explain
->
used_partitions
);
qpf
->
used_partitions_set
=
true
;
explain
->
used_partitions_set
=
true
;
}
}
else
else
qpf
->
used_partitions_set
=
false
;
explain
->
used_partitions_set
=
false
;
#else
#else
/* just produce empty column if partitioning is not compiled in */
/* just produce empty column if partitioning is not compiled in */
qpf
->
used_partitions_set
=
false
;
explain
->
used_partitions_set
=
false
;
#endif
#endif
}
}
...
@@ -118,42 +119,43 @@ void Update_plan::save_explain_data_intern(Explain_query *query, QPF_update *qpf
...
@@ -118,42 +119,43 @@ void Update_plan::save_explain_data_intern(Explain_query *query, QPF_update *qpf
(
quick_type
==
QUICK_SELECT_I
::
QS_TYPE_INDEX_INTERSECT
)
||
(
quick_type
==
QUICK_SELECT_I
::
QS_TYPE_INDEX_INTERSECT
)
||
(
quick_type
==
QUICK_SELECT_I
::
QS_TYPE_ROR_INTERSECT
)
||
(
quick_type
==
QUICK_SELECT_I
::
QS_TYPE_ROR_INTERSECT
)
||
(
quick_type
==
QUICK_SELECT_I
::
QS_TYPE_ROR_UNION
))
(
quick_type
==
QUICK_SELECT_I
::
QS_TYPE_ROR_UNION
))
qpf
->
jtype
=
JT_INDEX_MERGE
;
explain
->
jtype
=
JT_INDEX_MERGE
;
else
else
qpf
->
jtype
=
JT_RANGE
;
explain
->
jtype
=
JT_RANGE
;
}
}
else
else
{
{
if
(
index
==
MAX_KEY
)
if
(
index
==
MAX_KEY
)
qpf
->
jtype
=
JT_ALL
;
explain
->
jtype
=
JT_ALL
;
else
else
qpf
->
jtype
=
JT_NEXT
;
explain
->
jtype
=
JT_NEXT
;
}
}
qpf
->
using_where
=
test
(
select
&&
select
->
cond
);
explain
->
using_where
=
test
(
select
&&
select
->
cond
);
qpf
->
using_filesort
=
using_filesort
;
explain
->
using_filesort
=
using_filesort
;
make_possible_keys_line
(
table
,
possible_keys
,
&
qpf
->
possible_keys_line
);
make_possible_keys_line
(
table
,
possible_keys
,
&
explain
->
possible_keys_line
);
/* Calculate key_len */
/* Calculate key_len */
if
(
select
&&
select
->
quick
)
if
(
select
&&
select
->
quick
)
{
{
select
->
quick
->
add_keys_and_lengths
(
&
qpf
->
key_str
,
&
qpf
->
key_len_str
);
select
->
quick
->
add_keys_and_lengths
(
&
explain
->
key_str
,
&
explain
->
key_len_str
);
}
}
else
else
{
{
if
(
index
!=
MAX_KEY
)
if
(
index
!=
MAX_KEY
)
{
{
qpf
->
key_str
.
append
(
table
->
key_info
[
index
].
name
);
explain
->
key_str
.
append
(
table
->
key_info
[
index
].
name
);
}
}
// key_len stays NULL
// key_len stays NULL
}
}
qpf
->
rows
=
select
?
select
->
records
:
table_rows
;
explain
->
rows
=
select
?
select
->
records
:
table_rows
;
if
(
select
&&
select
->
quick
&&
if
(
select
&&
select
->
quick
&&
select
->
quick
->
get_type
()
==
QUICK_SELECT_I
::
QS_TYPE_RANGE
)
select
->
quick
->
get_type
()
==
QUICK_SELECT_I
::
QS_TYPE_RANGE
)
{
{
explain_append_mrr_info
((
QUICK_RANGE_SELECT
*
)
select
->
quick
,
&
qpf
->
mrr_type
);
explain_append_mrr_info
((
QUICK_RANGE_SELECT
*
)
select
->
quick
,
&
explain
->
mrr_type
);
}
}
bool
skip
=
updating_a_view
;
bool
skip
=
updating_a_view
;
...
@@ -173,7 +175,7 @@ void Update_plan::save_explain_data_intern(Explain_query *query, QPF_update *qpf
...
@@ -173,7 +175,7 @@ void Update_plan::save_explain_data_intern(Explain_query *query, QPF_update *qpf
clauses.
clauses.
*/
*/
if
(
!
(
unit
->
item
&&
unit
->
item
->
eliminated
))
if
(
!
(
unit
->
item
&&
unit
->
item
->
eliminated
))
qpf
->
add_child
(
unit
->
first_select
()
->
select_number
);
explain
->
add_child
(
unit
->
first_select
()
->
select_number
);
}
}
}
}
...
...
sql/sql_explain.cc
View file @
72bc6d73
...
@@ -511,7 +511,8 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
...
@@ -511,7 +511,8 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
/*
/*
Elements in this array match members of enum Extra_tag, defined in opt_qpf.h.
Elements in this array match members of enum Extra_tag, defined in
sql_explain.h
*/
*/
const
char
*
extra_tag_text
[]
=
const
char
*
extra_tag_text
[]
=
...
@@ -740,7 +741,8 @@ void Explain_quick_select::print_key_len(String *str)
...
@@ -740,7 +741,8 @@ void Explain_quick_select::print_key_len(String *str)
}
}
int
QPF_delete
::
print_explain
(
Explain_query
*
query
,
select_result_sink
*
output
,
int
Explain_delete
::
print_explain
(
Explain_query
*
query
,
select_result_sink
*
output
,
uint8
explain_flags
)
uint8
explain_flags
)
{
{
if
(
deleting_all_rows
)
if
(
deleting_all_rows
)
...
@@ -754,12 +756,13 @@ int QPF_delete::print_explain(Explain_query *query, select_result_sink *output,
...
@@ -754,12 +756,13 @@ int QPF_delete::print_explain(Explain_query *query, select_result_sink *output,
}
}
else
else
{
{
return
QPF
_update
::
print_explain
(
query
,
output
,
explain_flags
);
return
Explain
_update
::
print_explain
(
query
,
output
,
explain_flags
);
}
}
}
}
int
QPF_update
::
print_explain
(
Explain_query
*
query
,
select_result_sink
*
output
,
int
Explain_update
::
print_explain
(
Explain_query
*
query
,
select_result_sink
*
output
,
uint8
explain_flags
)
uint8
explain_flags
)
{
{
StringBuffer
<
64
>
extra_str
;
StringBuffer
<
64
>
extra_str
;
...
...
sql/sql_explain.h
View file @
72bc6d73
...
@@ -172,7 +172,7 @@ public:
...
@@ -172,7 +172,7 @@ public:
bool
using_filesort
;
bool
using_filesort
;
};
};
class
QPF
_delete
;
class
Explain
_delete
;
/*
/*
...
@@ -226,8 +226,8 @@ public:
...
@@ -226,8 +226,8 @@ public:
Explain_union
*
get_union
(
uint
select_id
);
Explain_union
*
get_union
(
uint
select_id
);
/*
QPF_delete inherits from QPF
_update */
/*
Explain_delete inherits from Explain
_update */
QPF
_update
*
upd_del_plan
;
Explain
_update
*
upd_del_plan
;
/* Produce a tabular EXPLAIN output */
/* Produce a tabular EXPLAIN output */
int
print_explain
(
select_result_sink
*
output
,
uint8
explain_flags
);
int
print_explain
(
select_result_sink
*
output
,
uint8
explain_flags
);
...
@@ -448,7 +448,7 @@ private:
...
@@ -448,7 +448,7 @@ private:
Also, it can have UPDATE operation options, but currently there aren't any.
Also, it can have UPDATE operation options, but currently there aren't any.
*/
*/
class
QPF
_update
:
public
Explain_node
class
Explain
_update
:
public
Explain_node
{
{
public:
public:
virtual
enum
explain_node_type
get_type
()
{
return
EXPLAIN_UPDATE
;
}
virtual
enum
explain_node_type
get_type
()
{
return
EXPLAIN_UPDATE
;
}
...
@@ -479,10 +479,10 @@ public:
...
@@ -479,10 +479,10 @@ public:
/*
/*
Query Plan Footprint for
a single-table DELETE.
Explain data of
a single-table DELETE.
*/
*/
class
QPF_delete
:
public
QPF
_update
class
Explain_delete
:
public
Explain
_update
{
{
public:
public:
/*
/*
...
...
sql/sql_join_cache.cc
View file @
72bc6d73
...
@@ -2568,22 +2568,22 @@ finish:
...
@@ -2568,22 +2568,22 @@ finish:
none
none
*/
*/
void
JOIN_CACHE
::
save_explain_data
(
struct
st_explain_bka_type
*
qpf
)
void
JOIN_CACHE
::
save_explain_data
(
struct
st_explain_bka_type
*
explain
)
{
{
qpf
->
incremental
=
test
(
prev_cache
);
explain
->
incremental
=
test
(
prev_cache
);
switch
(
get_join_alg
())
{
switch
(
get_join_alg
())
{
case
BNL_JOIN_ALG
:
case
BNL_JOIN_ALG
:
qpf
->
join_alg
=
"BNL"
;
explain
->
join_alg
=
"BNL"
;
break
;
break
;
case
BNLH_JOIN_ALG
:
case
BNLH_JOIN_ALG
:
qpf
->
join_alg
=
"BNLH"
;
explain
->
join_alg
=
"BNLH"
;
break
;
break
;
case
BKA_JOIN_ALG
:
case
BKA_JOIN_ALG
:
qpf
->
join_alg
=
"BKA"
;
explain
->
join_alg
=
"BKA"
;
break
;
break
;
case
BKAH_JOIN_ALG
:
case
BKAH_JOIN_ALG
:
qpf
->
join_alg
=
"BKAH"
;
explain
->
join_alg
=
"BKAH"
;
break
;
break
;
default:
default:
DBUG_ASSERT
(
0
);
DBUG_ASSERT
(
0
);
...
@@ -2613,17 +2613,17 @@ static void add_mrr_explain_info(String *str, uint mrr_mode, handler *file)
...
@@ -2613,17 +2613,17 @@ static void add_mrr_explain_info(String *str, uint mrr_mode, handler *file)
}
}
}
}
void
JOIN_CACHE_BKA
::
save_explain_data
(
struct
st_explain_bka_type
*
qpf
)
void
JOIN_CACHE_BKA
::
save_explain_data
(
struct
st_explain_bka_type
*
explain
)
{
{
JOIN_CACHE
::
save_explain_data
(
qpf
);
JOIN_CACHE
::
save_explain_data
(
explain
);
add_mrr_explain_info
(
&
qpf
->
mrr_type
,
mrr_mode
,
join_tab
->
table
->
file
);
add_mrr_explain_info
(
&
explain
->
mrr_type
,
mrr_mode
,
join_tab
->
table
->
file
);
}
}
void
JOIN_CACHE_BKAH
::
save_explain_data
(
struct
st_explain_bka_type
*
qpf
)
void
JOIN_CACHE_BKAH
::
save_explain_data
(
struct
st_explain_bka_type
*
explain
)
{
{
JOIN_CACHE
::
save_explain_data
(
qpf
);
JOIN_CACHE
::
save_explain_data
(
explain
);
add_mrr_explain_info
(
&
qpf
->
mrr_type
,
mrr_mode
,
join_tab
->
table
->
file
);
add_mrr_explain_info
(
&
explain
->
mrr_type
,
mrr_mode
,
join_tab
->
table
->
file
);
}
}
...
...
sql/sql_join_cache.h
View file @
72bc6d73
...
@@ -658,7 +658,7 @@ public:
...
@@ -658,7 +658,7 @@ public:
enum_nested_loop_state
join_records
(
bool
skip_last
);
enum_nested_loop_state
join_records
(
bool
skip_last
);
/* Add a comment on the join algorithm employed by the join cache */
/* Add a comment on the join algorithm employed by the join cache */
virtual
void
save_explain_data
(
struct
st_explain_bka_type
*
qpf
);
virtual
void
save_explain_data
(
struct
st_explain_bka_type
*
explain
);
THD
*
thd
();
THD
*
thd
();
...
@@ -1336,7 +1336,7 @@ public:
...
@@ -1336,7 +1336,7 @@ public:
/* Check index condition of the joined table for a record from BKA cache */
/* Check index condition of the joined table for a record from BKA cache */
bool
skip_index_tuple
(
range_id_t
range_info
);
bool
skip_index_tuple
(
range_id_t
range_info
);
void
save_explain_data
(
struct
st_explain_bka_type
*
qpf
);
void
save_explain_data
(
struct
st_explain_bka_type
*
explain
);
};
};
...
@@ -1427,5 +1427,5 @@ public:
...
@@ -1427,5 +1427,5 @@ public:
/* Check index condition of the joined table for a record from BKAH cache */
/* Check index condition of the joined table for a record from BKAH cache */
bool
skip_index_tuple
(
range_id_t
range_info
);
bool
skip_index_tuple
(
range_id_t
range_info
);
void
save_explain_data
(
struct
st_explain_bka_type
*
qpf
);
void
save_explain_data
(
struct
st_explain_bka_type
*
explain
);
};
};
sql/sql_lex.cc
View file @
72bc6d73
...
@@ -4264,12 +4264,12 @@ int st_select_lex_unit::save_union_explain(Explain_query *output)
...
@@ -4264,12 +4264,12 @@ int st_select_lex_unit::save_union_explain(Explain_query *output)
const
char
*
msg
=
"Query plan already deleted"
;
const
char
*
msg
=
"Query plan already deleted"
;
first
->
set_explain_type
(
TRUE
/* on_the_fly */
);
first
->
set_explain_type
(
TRUE
/* on_the_fly */
);
Explain_select
*
qp_sel
=
new
(
output
->
mem_root
)
Explain_select
;
Explain_select
*
explain
=
new
(
output
->
mem_root
)
Explain_select
;
qp_sel
->
select_id
=
first
->
select_number
;
explain
->
select_id
=
first
->
select_number
;
qp_sel
->
select_type
=
first
->
type
;
explain
->
select_type
=
first
->
type
;
qp_sel
->
message
=
msg
;
explain
->
message
=
msg
;
output
->
add_node
(
qp_sel
);
output
->
add_node
(
explain
);
eu
->
add_select
(
qp_sel
->
select_id
);
eu
->
add_select
(
explain
->
select_id
);
return
0
;
return
0
;
}
}
...
...
sql/sql_lex.h
View file @
72bc6d73
...
@@ -2369,7 +2369,7 @@ class Delete_plan;
...
@@ -2369,7 +2369,7 @@ class Delete_plan;
class
SQL_SELECT
;
class
SQL_SELECT
;
class
Explain_query
;
class
Explain_query
;
class
QPF
_update
;
class
Explain
_update
;
/*
/*
Query plan of a single-table UPDATE.
Query plan of a single-table UPDATE.
...
@@ -2399,7 +2399,7 @@ public:
...
@@ -2399,7 +2399,7 @@ public:
void
set_impossible_where
()
{
impossible_where
=
true
;
}
void
set_impossible_where
()
{
impossible_where
=
true
;
}
void
save_explain_data
(
Explain_query
*
query
);
void
save_explain_data
(
Explain_query
*
query
);
void
save_explain_data_intern
(
Explain_query
*
query
,
QPF_update
*
qpf
);
void
save_explain_data_intern
(
Explain_query
*
query
,
Explain_update
*
eu
);
virtual
~
Update_plan
()
{}
virtual
~
Update_plan
()
{}
Update_plan
()
:
impossible_where
(
false
),
using_filesort
(
false
)
{}
Update_plan
()
:
impossible_where
(
false
),
using_filesort
(
false
)
{}
...
...
sql/sql_select.cc
View file @
72bc6d73
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment