summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2018-10-07 10:19:19 -0700
committerIgor Babaev <igor@askmonty.org>2018-10-07 10:19:19 -0700
commit0b7339eb451d5ffb141ac0a89b3596eec6dc948f (patch)
treefbbd1a5cec5e8a9a16a0d42d42a957977cdbbc71 /sql/sql_select.cc
parent9905949b414740cdb15d5048b3289e4c5bb54f93 (diff)
downloadmariadb-git-0b7339eb451d5ffb141ac0a89b3596eec6dc948f.tar.gz
MDEV-17382 Hash join algorithm should not be used to join materialized
derived table / view by equality Now rows of a materialized derived table are always put into a temporary table before join operation. If BNLH is used to join this table with the result of a partial join then both operands of the join are actually put into main memory. In most cases this is not efficient. We could avoid this by sending the rows of the derived table directly to the join operation. However this kind of data flow is not supported yet. Fixed by not allowing usage of hash join algorithm to join a materialized derived table if it's joined by an equality predicate of the form f=e where f is a field of the derived table.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index b2b2bcde80c..35937f0536f 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -10054,7 +10054,15 @@ uint check_join_cache_usage(JOIN_TAB *tab,
effort now.
*/
if (tab->table->pos_in_table_list->is_materialized_derived())
+ {
no_bka_cache= true;
+ /*
+ Don't use hash join algorithm if the temporary table for the rows
+ of the derived table will be created with an equi-join key.
+ */
+ if (tab->table->s->keys)
+ no_hashed_cache= true;
+ }
/*
Don't use join buffering if we're dictated not to by no_jbuf_after