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 14:42:22 -0700
commit1eca49577e979220f3ab663a7e46e0eb70d728c4 (patch)
tree00408fdf6193db8ecd4e3c7e3ca4bd67e10c07c1 /sql/sql_select.cc
parent079d0a8724aa3faa3117554c44b81965df457ef3 (diff)
downloadmariadb-git-1eca49577e979220f3ab663a7e46e0eb70d728c4.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 fa0be81ff3d..62f40eeb99c 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -11005,7 +11005,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