diff options
author | Igor Babaev <igor@askmonty.org> | 2017-09-08 11:26:35 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2017-09-08 11:27:02 -0700 |
commit | 5e4aa1a2f8a4c2be30bac06717505b3591af7965 (patch) | |
tree | 8d301e106b3e4aa66167c3f68d4f389ac57e551c /sql/sql_derived.cc | |
parent | fb14761d66fd870c29024ee36767749e0d374861 (diff) | |
download | mariadb-git-5e4aa1a2f8a4c2be30bac06717505b3591af7965.tar.gz |
Fixed the bug mdev-13709.
Currently condition pushdown into materialized views / derived tables
is not implemented yet (see mdev-12387) and grouping views are
optimized early when subqueries are converted to semi-joins in
convert_join_subqueries_to_semijoins(). If a subquery that is converted
to a semi-join uses a grouping view this view is optimized in two phases.
For such a view V only the first phase of optimization is done after
the conversion of subqueries of the outer join into semi-joins.
At the same time the reference of the view V appears in the join
expression of the outer join. In fixed code there was an attempt to push
conditions into this view and to optimize it after this. This triggered
the second phase of the optimization of the view and it was done
prematurely. The second phase of the optimization for the materialized
view is supposed to be called after the splitting condition is pushed
into the view in the call of JOIN::improve_chosen_plan for the outer
join.
The fix blocks the attempt to push conditions into splittable views
if they have been already partly optimized and the following
optimization for them.
The test case of the patch shows that the code for mdev-13369
basically supported the splitting technique for materialized views /
derived tables.
The patch also replaces the name of the state JOIN::OPTIMIZATION_IN_STAGE_2
for JOIN::OPTIMIZATION_PHASE_1_DONE and fixes a bug in
TABLE_LIST::fetch_number_of_rows()
Diffstat (limited to 'sql/sql_derived.cc')
-rw-r--r-- | sql/sql_derived.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index adcba993345..5244a083939 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -891,7 +891,7 @@ bool mysql_derived_optimize(THD *thd, LEX *lex, TABLE_LIST *derived) JOIN *join= first_select->join; unit->set_limit(unit->global_parameters()); if (join && - join->optimization_state == JOIN::OPTIMIZATION_IN_STAGE_2 && + join->optimization_state == JOIN::OPTIMIZATION_PHASE_1_DONE && join->with_two_phase_optimization) { if (unit->optimized_2) |