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
56c0e19e
Commit
56c0e19e
authored
May 18, 2011
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MWL#89 Addressing Sergey's review comments - Part 1.
Address the 'trivial' part of Sergey's review of MWL#89.
parent
c22045aa
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
17 deletions
+19
-17
sql/item.h
sql/item.h
+1
-1
sql/item_subselect.cc
sql/item_subselect.cc
+1
-1
sql/opt_subselect.cc
sql/opt_subselect.cc
+2
-2
sql/sql_select.cc
sql/sql_select.cc
+5
-4
sql/sql_select.h
sql/sql_select.h
+10
-9
No files found.
sql/item.h
View file @
56c0e19e
...
@@ -536,7 +536,7 @@ class Item {
...
@@ -536,7 +536,7 @@ class Item {
SUBSELECT_ITEM
,
ROW_ITEM
,
CACHE_ITEM
,
TYPE_HOLDER
,
SUBSELECT_ITEM
,
ROW_ITEM
,
CACHE_ITEM
,
TYPE_HOLDER
,
PARAM_ITEM
,
TRIGGER_FIELD_ITEM
,
DECIMAL_ITEM
,
PARAM_ITEM
,
TRIGGER_FIELD_ITEM
,
DECIMAL_ITEM
,
XPATH_NODESET
,
XPATH_NODESET_CMP
,
XPATH_NODESET
,
XPATH_NODESET_CMP
,
VIEW_FIXER_ITEM
,
EXPR_CACHE_ITEM
,
UNKNOWN_ITEM
};
VIEW_FIXER_ITEM
,
EXPR_CACHE_ITEM
};
enum
cond_result
{
COND_UNDEF
,
COND_OK
,
COND_TRUE
,
COND_FALSE
};
enum
cond_result
{
COND_UNDEF
,
COND_OK
,
COND_TRUE
,
COND_FALSE
};
...
...
sql/item_subselect.cc
View file @
56c0e19e
...
@@ -1766,7 +1766,7 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN * join,
...
@@ -1766,7 +1766,7 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN * join,
*
having_item
=
new_having
;
*
having_item
=
new_having
;
}
}
else
else
DBUG_ASSERT
(
FALSE
);
DBUG_ASSERT
(
false
);
}
}
}
}
...
...
sql/opt_subselect.cc
View file @
56c0e19e
...
@@ -3640,7 +3640,7 @@ static void remove_subq_pushed_predicates(JOIN *join, Item **where)
...
@@ -3640,7 +3640,7 @@ static void remove_subq_pushed_predicates(JOIN *join, Item **where)
/**
/**
Optimize all subqueries of a query that
have were
flattened into a semijoin.
Optimize all subqueries of a query that
were not
flattened into a semijoin.
@details
@details
Optimize all immediate children subqueries of a query.
Optimize all immediate children subqueries of a query.
...
@@ -3699,7 +3699,7 @@ bool JOIN::optimize_unflattened_subqueries()
...
@@ -3699,7 +3699,7 @@ bool JOIN::optimize_unflattened_subqueries()
bool
JOIN
::
choose_subquery_plan
(
table_map
join_tables
)
bool
JOIN
::
choose_subquery_plan
(
table_map
join_tables
)
{
{
Query
_plan_state
save_qep
;
/* The original QEP of the subquery. */
Join
_plan_state
save_qep
;
/* The original QEP of the subquery. */
enum_reopt_result
reopt_result
=
REOPT_NONE
;
enum_reopt_result
reopt_result
=
REOPT_NONE
;
Item_in_subselect
*
in_subs
;
Item_in_subselect
*
in_subs
;
...
...
sql/sql_select.cc
View file @
56c0e19e
...
@@ -959,7 +959,8 @@ JOIN::optimize()
...
@@ -959,7 +959,8 @@ JOIN::optimize()
*/
*/
if
((
res
=
opt_sum_query
(
thd
,
select_lex
->
leaf_tables
,
all_fields
,
conds
)))
if
((
res
=
opt_sum_query
(
thd
,
select_lex
->
leaf_tables
,
all_fields
,
conds
)))
{
{
if
(
res
==
HA_ERR_KEY_NOT_FOUND
||
res
<
0
)
DBUG_ASSERT
(
res
>=
0
);
if
(
res
==
HA_ERR_KEY_NOT_FOUND
)
{
{
DBUG_PRINT
(
"info"
,(
"No matching min/max row"
));
DBUG_PRINT
(
"info"
,(
"No matching min/max row"
));
zero_result_cause
=
"No matching min/max row"
;
zero_result_cause
=
"No matching min/max row"
;
...
@@ -20528,7 +20529,7 @@ void JOIN::set_allowed_join_cache_types()
...
@@ -20528,7 +20529,7 @@ void JOIN::set_allowed_join_cache_types()
@param save_to The object into which the current query plan state is saved
@param save_to The object into which the current query plan state is saved
*/
*/
void
JOIN
::
save_query_plan
(
Query
_plan_state
*
save_to
)
void
JOIN
::
save_query_plan
(
Join
_plan_state
*
save_to
)
{
{
if
(
keyuse
.
elements
)
if
(
keyuse
.
elements
)
{
{
...
@@ -20558,7 +20559,7 @@ void JOIN::save_query_plan(Query_plan_state *save_to)
...
@@ -20558,7 +20559,7 @@ void JOIN::save_query_plan(Query_plan_state *save_to)
@param The object from which the current query plan state is restored.
@param The object from which the current query plan state is restored.
*/
*/
void
JOIN
::
restore_query_plan
(
Query
_plan_state
*
restore_from
)
void
JOIN
::
restore_query_plan
(
Join
_plan_state
*
restore_from
)
{
{
if
(
restore_from
->
keyuse
.
elements
)
if
(
restore_from
->
keyuse
.
elements
)
{
{
...
@@ -20607,7 +20608,7 @@ void JOIN::restore_query_plan(Query_plan_state *restore_from)
...
@@ -20607,7 +20608,7 @@ void JOIN::restore_query_plan(Query_plan_state *restore_from)
JOIN
::
enum_reopt_result
JOIN
::
enum_reopt_result
JOIN
::
reoptimize
(
Item
*
added_where
,
table_map
join_tables
,
JOIN
::
reoptimize
(
Item
*
added_where
,
table_map
join_tables
,
Query
_plan_state
*
save_to
)
Join
_plan_state
*
save_to
)
{
{
DYNAMIC_ARRAY
added_keyuse
;
DYNAMIC_ARRAY
added_keyuse
;
SARGABLE_PARAM
*
sargables
=
0
;
/* Used only as a dummy parameter. */
SARGABLE_PARAM
*
sargables
=
0
;
/* Used only as a dummy parameter. */
...
...
sql/sql_select.h
View file @
56c0e19e
...
@@ -611,9 +611,10 @@ class JOIN :public Sql_alloc
...
@@ -611,9 +611,10 @@ class JOIN :public Sql_alloc
/**
/**
The subset of the state of a JOIN that represents an optimized query
The subset of the state of a JOIN that represents an optimized query
execution plan. Allows saving/restoring different plans for the same query.
execution plan. Allows saving/restoring different JOIN plans for the same
query.
*/
*/
class
Query
_plan_state
{
class
Join
_plan_state
{
public:
public:
DYNAMIC_ARRAY
keyuse
;
/* Copy of the JOIN::keyuse array. */
DYNAMIC_ARRAY
keyuse
;
/* Copy of the JOIN::keyuse array. */
POSITION
best_positions
[
MAX_TABLES
+
1
];
/* Copy of JOIN::best_positions */
POSITION
best_positions
[
MAX_TABLES
+
1
];
/* Copy of JOIN::best_positions */
...
@@ -622,13 +623,13 @@ class JOIN :public Sql_alloc
...
@@ -622,13 +623,13 @@ class JOIN :public Sql_alloc
/* Copies of JOIN_TAB::checked_keys for each JOIN_TAB. */
/* Copies of JOIN_TAB::checked_keys for each JOIN_TAB. */
key_map
join_tab_checked_keys
[
MAX_TABLES
];
key_map
join_tab_checked_keys
[
MAX_TABLES
];
public:
public:
Query
_plan_state
()
Join
_plan_state
()
{
{
keyuse
.
elements
=
0
;
keyuse
.
elements
=
0
;
keyuse
.
buffer
=
NULL
;
keyuse
.
buffer
=
NULL
;
}
}
Query
_plan_state
(
JOIN
*
join
);
Join
_plan_state
(
JOIN
*
join
);
~
Query
_plan_state
()
~
Join
_plan_state
()
{
{
delete_dynamic
(
&
keyuse
);
delete_dynamic
(
&
keyuse
);
}
}
...
@@ -644,9 +645,9 @@ class JOIN :public Sql_alloc
...
@@ -644,9 +645,9 @@ class JOIN :public Sql_alloc
/* Support for plan reoptimization with rewritten conditions. */
/* Support for plan reoptimization with rewritten conditions. */
enum_reopt_result
reoptimize
(
Item
*
added_where
,
table_map
join_tables
,
enum_reopt_result
reoptimize
(
Item
*
added_where
,
table_map
join_tables
,
Query
_plan_state
*
save_to
);
Join
_plan_state
*
save_to
);
void
save_query_plan
(
Query
_plan_state
*
save_to
);
void
save_query_plan
(
Join
_plan_state
*
save_to
);
void
restore_query_plan
(
Query
_plan_state
*
restore_from
);
void
restore_query_plan
(
Join
_plan_state
*
restore_from
);
/* Choose a subquery plan for a table-less subquery. */
/* Choose a subquery plan for a table-less subquery. */
bool
choose_tableless_subquery_plan
();
bool
choose_tableless_subquery_plan
();
...
@@ -748,7 +749,7 @@ class JOIN :public Sql_alloc
...
@@ -748,7 +749,7 @@ class JOIN :public Sql_alloc
*/
*/
double
best_read
;
double
best_read
;
/*
/*
Estimated result rows (fanout) of the
whole query
. If this is a subquery
Estimated result rows (fanout) of the
join operation
. If this is a subquery
that is reexecuted multiple times, this value includes the estiamted # of
that is reexecuted multiple times, this value includes the estiamted # of
reexecutions. This value is equal to the multiplication of all
reexecutions. This value is equal to the multiplication of all
join->positions[i].records_read of a JOIN.
join->positions[i].records_read of a JOIN.
...
...
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