summaryrefslogtreecommitdiff
path: root/sql/item_subselect.cc
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2019-05-04 21:33:39 +0300
committerSergei Petrunia <psergey@askmonty.org>2019-05-16 13:03:58 +0300
commitb1f828a82afb93d19421c24b48eb09aa0e37b03a (patch)
treeb4e061d01d07b44bc1f7b96701d6d50e44c90b77 /sql/item_subselect.cc
parent366bf10475e483a9da4c68a8214159d90bd5358a (diff)
downloadmariadb-git-b1f828a82afb93d19421c24b48eb09aa0e37b03a.tar.gz
MDEV-19134: EXISTS() slower if ORDER BY is defined
Step 1: Removal of ORDER BY [LIMIT] from the subquery should be done earlier and for broader class of subqueries. The rewrite was done in Item_in_subselect::select_in_like_transformer(), but this had problems: - It didn't cover EXISTS subqueries - It covered IN-subqueries, but was done after the semi-join transformation was considered inapplicable, because ORDER BY was present. Remaining issue: - EXISTS->IN transformation happens before check_and_do_in_subquery_rewrites() is called, so it is still prevented by the present ORDER BY.
Diffstat (limited to 'sql/item_subselect.cc')
-rw-r--r--sql/item_subselect.cc15
1 files changed, 0 insertions, 15 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index e32a730214a..aaf2aa60fc6 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -3204,21 +3204,6 @@ Item_in_subselect::select_in_like_transformer(JOIN *join)
DBUG_ENTER("Item_in_subselect::select_in_like_transformer");
DBUG_ASSERT(thd == join->thd);
-
- /*
- IN/SOME/ALL/ANY subqueries aren't support LIMIT clause. Without it
- ORDER BY clause becomes meaningless thus we drop it here.
- */
- for (SELECT_LEX *sl= current->master_unit()->first_select();
- sl; sl= sl->next_select())
- {
- if (sl->join)
- {
- sl->join->order= 0;
- sl->join->skip_sort_order= 1;
- }
- }
-
thd->where= "IN/ALL/ANY subquery";
/*