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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
ae6e95c4
Commit
ae6e95c4
authored
Sep 17, 2013
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup.
parent
abf4a910
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
47 deletions
+21
-47
sql/opt_qpf.cc
sql/opt_qpf.cc
+3
-7
sql/opt_qpf.h
sql/opt_qpf.h
+3
-2
sql/sql_delete.cc
sql/sql_delete.cc
+8
-13
sql/sql_lex.h
sql/sql_lex.h
+3
-3
sql/sql_select.cc
sql/sql_select.cc
+2
-19
sql/sql_update.cc
sql/sql_update.cc
+2
-3
No files found.
sql/opt_qpf.cc
View file @
ae6e95c4
...
...
@@ -81,14 +81,13 @@ void QPF_query::add_node(QPF_node *node)
QPF_select
*
sel
=
(
QPF_select
*
)
node
;
if
(
sel
->
select_id
==
(
int
)
UINT_MAX
)
{
//TODO this is a "fake select" from a UNION.
DBUG_ASSERT
(
0
);
DBUG_ASSERT
(
0
);
// this is a "fake select" from a UNION.
}
else
{
uint
select_id
=
sel
->
select_id
;
QPF_select
*
old_node
;
//DBUG_ASSERT(!get_select(select_id));
if
(
selects
.
elements
()
<=
select_id
)
selects
.
resize
(
max
(
select_id
+
1
,
selects
.
elements
()
*
2
),
NULL
);
...
...
@@ -115,7 +114,7 @@ int QPF_query::print_explain(select_result_sink *output,
}
else
{
/
/ Start printing from id=1
/
* Start printing from node with id=1 */
QPF_node
*
node
=
get_node
(
1
);
return
node
->
print_explain
(
this
,
output
,
explain_flags
);
}
...
...
@@ -264,8 +263,6 @@ QPF_select::~QPF_select()
int
QPF_select
::
print_explain
(
QPF_query
*
query
,
select_result_sink
*
output
,
uint8
explain_flags
)
{
//output->unit.offset_limit_cnt= 0;
if
(
message
)
{
List
<
Item
>
item_list
;
...
...
@@ -328,7 +325,6 @@ int QPF_table_access::print_explain(select_result_sink *output, uint8 explain_fl
List
<
Item
>
item_list
;
Item
*
item_null
=
new
Item_null
();
//const CHARSET_INFO *cs= system_charset_info;
if
(
sjm_nest_select_id
)
select_id
=
sjm_nest_select_id
;
...
...
sql/opt_qpf.h
View file @
ae6e95c4
...
...
@@ -361,7 +361,7 @@ class QPF_table_access : public Sql_alloc
StringBuffer
<
32
>
used_partitions
;
bool
used_partitions_set
;
/* Empty string
s
means "NULL" will be printed */
/* Empty string means "NULL" will be printed */
StringBuffer
<
32
>
possible_keys_str
;
/*
...
...
@@ -375,7 +375,8 @@ class QPF_table_access : public Sql_alloc
QPF_index_use
key
;
/*
when type==JT_HASH_NEXT, this stores the real index.
when type==JT_HASH_NEXT, 'key' stores the hash join pseudo-key.
hash_next_key stores the table's key.
*/
QPF_index_use
hash_next_key
;
...
...
sql/sql_delete.cc
View file @
ae6e95c4
...
...
@@ -51,7 +51,7 @@
invoked on a running DELETE statement.
*/
void
Delete_plan
::
save_q
uery_plan_footprint
(
QPF_query
*
query
)
void
Delete_plan
::
save_q
pf
(
QPF_query
*
query
)
{
QPF_delete
*
qpf
=
new
QPF_delete
;
...
...
@@ -63,22 +63,22 @@ void Delete_plan::save_query_plan_footprint(QPF_query *query)
else
{
qpf
->
deleting_all_rows
=
false
;
Update_plan
::
save_q
uery_plan_footprint
_intern
(
query
,
qpf
);
Update_plan
::
save_q
pf
_intern
(
query
,
qpf
);
}
query
->
upd_del_plan
=
qpf
;
}
void
Update_plan
::
save_q
uery_plan_footprint
(
QPF_query
*
query
)
void
Update_plan
::
save_q
pf
(
QPF_query
*
query
)
{
QPF_update
*
qpf
=
new
QPF_update
;
save_q
uery_plan_footprint
_intern
(
query
,
qpf
);
save_q
pf
_intern
(
query
,
qpf
);
query
->
upd_del_plan
=
qpf
;
}
void
Update_plan
::
save_q
uery_plan_footprint
_intern
(
QPF_query
*
query
,
QPF_update
*
qpf
)
void
Update_plan
::
save_q
pf
_intern
(
QPF_query
*
query
,
QPF_update
*
qpf
)
{
qpf
->
select_type
=
"SIMPLE"
;
qpf
->
table_name
.
append
(
table
->
pos_in_table_list
->
alias
);
...
...
@@ -116,7 +116,6 @@ void Update_plan::save_query_plan_footprint_intern(QPF_query *query, QPF_update
qpf
->
using_where
=
test
(
select
&&
select
->
cond
);
qpf
->
using_filesort
=
using_filesort
;
//using_filesort is already set
make_possible_keys_line
(
table
,
possible_keys
,
&
qpf
->
possible_keys_line
);
/* Calculate key_len */
...
...
@@ -141,6 +140,7 @@ void Update_plan::save_query_plan_footprint_intern(QPF_query *query, QPF_update
}
bool
skip
=
updating_a_view
;
/* Save subquery children */
for
(
SELECT_LEX_UNIT
*
unit
=
select_lex
->
first_inner_unit
();
unit
;
...
...
@@ -157,11 +157,6 @@ void Update_plan::save_query_plan_footprint_intern(QPF_query *query, QPF_update
*/
if
(
!
(
unit
->
item
&&
unit
->
item
->
eliminated
))
qpf
->
add_child
(
unit
->
first_select
()
->
select_number
);
//TODO: temporary?:
// A: yes. optimizing children subqueries has caused them to save QPFs,
// automatically.
//unit->save_qpf(query);
}
}
...
...
@@ -423,7 +418,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
if
(
thd
->
lex
->
describe
)
goto
exit_without_my_ok
;
query_plan
.
save_q
uery_plan_footprint
(
thd
->
lex
->
query_plan_footprint
);
query_plan
.
save_q
pf
(
thd
->
lex
->
query_plan_footprint
);
thd
->
apc_target
.
enable
();
DBUG_EXECUTE_IF
(
"show_explain_probe_delete_exec_start"
,
...
...
@@ -656,7 +651,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
/* Special exits */
exit_without_my_ok:
query_plan
.
save_q
uery_plan_footprint
(
thd
->
lex
->
query_plan_footprint
);
query_plan
.
save_q
pf
(
thd
->
lex
->
query_plan_footprint
);
select_send
*
result2
;
if
(
!
(
result2
=
new
select_send
()))
...
...
sql/sql_lex.h
View file @
ae6e95c4
...
...
@@ -2397,8 +2397,8 @@ class Update_plan
/* Set this plan to be a plan to do nothing because of impossible WHRE*/
void
set_impossible_where
()
{
impossible_where
=
true
;
}
void
save_q
uery_plan_footprint
(
QPF_query
*
query
);
void
save_q
uery_plan_footprint
_intern
(
QPF_query
*
query
,
QPF_update
*
qpf
);
void
save_q
pf
(
QPF_query
*
query
);
void
save_q
pf
_intern
(
QPF_query
*
query
,
QPF_update
*
qpf
);
virtual
~
Update_plan
()
{}
Update_plan
()
:
impossible_where
(
false
),
using_filesort
(
false
)
{}
...
...
@@ -2422,7 +2422,7 @@ class Delete_plan : public Update_plan
table_rows
=
rows_arg
;
}
void
save_q
uery_plan_footprint
(
QPF_query
*
query
);
void
save_q
pf
(
QPF_query
*
query
);
};
...
...
sql/sql_select.cc
View file @
ae6e95c4
...
...
@@ -22517,8 +22517,6 @@ int JOIN::save_qpf(QPF_query *output, bool need_tmp_table, bool need_order,
bool
distinct
,
const
char
*
message
)
{
QPF_node
*
qp_node
;
const
bool
on_the_fly
=
true
;
JOIN
*
join
=
this
;
/* Legacy: this code used to be a non-member function */
THD
*
thd
=
join
->
thd
;
const
CHARSET_INFO
*
cs
=
system_charset_info
;
...
...
@@ -22535,7 +22533,7 @@ int JOIN::save_qpf(QPF_query *output, bool need_tmp_table, bool need_order,
{
QPF_select
*
qp_sel
;
qp_node
=
qp_sel
=
new
(
output
->
mem_root
)
QPF_select
;
join
->
select_lex
->
set_explain_type
(
on_the_fly
);
join
->
select_lex
->
set_explain_type
(
true
);
qp_sel
->
select_id
=
join
->
select_lex
->
select_number
;
qp_sel
->
select_type
=
join
->
select_lex
->
type
;
...
...
@@ -22554,10 +22552,7 @@ int JOIN::save_qpf(QPF_query *output, bool need_tmp_table, bool need_order,
qp_node
=
qp_sel
=
new
(
output
->
mem_root
)
QPF_select
;
table_map
used_tables
=
0
;
if
(
on_the_fly
)
join
->
select_lex
->
set_explain_type
(
on_the_fly
);
//bool printing_materialize_nest= FALSE;
join
->
select_lex
->
set_explain_type
(
true
);
uint
select_id
=
join
->
select_lex
->
select_number
;
qp_sel
->
select_id
=
join
->
select_lex
->
select_number
;
...
...
@@ -22568,13 +22563,6 @@ int JOIN::save_qpf(QPF_query *output, bool need_tmp_table, bool need_order,
for
(
JOIN_TAB
*
tab
=
first_breadth_first_tab
(
join
,
WALK_OPTIMIZATION_TABS
);
tab
;
tab
=
next_breadth_first_tab
(
join
,
WALK_OPTIMIZATION_TABS
,
tab
))
{
if
(
tab
->
bush_root_tab
)
{
JOIN_TAB
*
first_sibling
=
tab
->
bush_root_tab
->
bush_children
->
start
;
select_id
=
first_sibling
->
emb_sj_nest
->
sj_subq_pred
->
get_identifier
();
//printing_materialize_nest= TRUE;
}
TABLE
*
table
=
tab
->
table
;
TABLE_LIST
*
table_list
=
tab
->
table
->
pos_in_table_list
;
char
buff4
[
512
];
...
...
@@ -22615,9 +22603,6 @@ int JOIN::save_qpf(QPF_query *output, bool need_tmp_table, bool need_order,
qpt
->
sjm_nest_select_id
=
0
;
/* select_type */
//const char* stype= printing_materialize_nest? "MATERIALIZED" :
// join->select_lex->type;
//item_list.push_back(new Item_string(stype, strlen(stype), cs));
qp_sel
->
select_type
=
join
->
select_lex
->
type
;
/* table */
...
...
@@ -22684,8 +22669,6 @@ int JOIN::save_qpf(QPF_query *output, bool need_tmp_table, bool need_order,
append_possible_keys
(
&
qpt
->
possible_keys_str
,
table
,
tab
->
keys
);
/* Build "key", "key_len", and "ref" */
// tmp4 holds ref
if
(
tab_type
==
JT_NEXT
)
{
key_info
=
table
->
key_info
+
tab
->
index
;
...
...
sql/sql_update.cc
View file @
ae6e95c4
...
...
@@ -500,7 +500,7 @@ int mysql_update(THD *thd,
if
(
thd
->
lex
->
describe
)
goto
exit_without_my_ok
;
query_plan
.
save_q
uery_plan_footprint
(
thd
->
lex
->
query_plan_footprint
);
query_plan
.
save_q
pf
(
thd
->
lex
->
query_plan_footprint
);
thd
->
apc_target
.
enable
();
apc_target_enabled
=
true
;
DBUG_EXECUTE_IF
(
"show_explain_probe_update_exec_start"
,
...
...
@@ -1031,10 +1031,9 @@ int mysql_update(THD *thd,
exit_without_my_ok:
DBUG_ASSERT
(
!
apc_target_enabled
);
query_plan
.
save_q
uery_plan_footprint
(
thd
->
lex
->
query_plan_footprint
);
query_plan
.
save_q
pf
(
thd
->
lex
->
query_plan_footprint
);
select_send
*
result
;
//bool printed_anything;
if
(
!
(
result
=
new
select_send
()))
return
1
;
/* purecov: inspected */
List
<
Item
>
dummy
;
/* note: looked in 5.6 and they too use a dummy list like this */
...
...
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