1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MWL#89: Cost-based choice between Materialization and IN->EXISTS transformation

- Added more tests to the MWL#89 specific test, and made the test more modular.
- Updated test files.
- Fixed a memory leak.
- More comments.

mysql-test/r/subselect_mat.result:
  - Updated the test file to reflect the new optimizer switches related to
    materialized subquery execution.
  - Added one extra test to test all cases that expose BUG#40037 (this is an old bug from 5.x).
  - Updated the test result with correct results that expose BUG#40037.
mysql-test/t/subselect_mat.test:
  - Updated the test file to reflect the new optimizer switches related to
    materialized subquery execution.
  - Added one extra test to test all cases that expose BUG#40037 (this is an old bug from 5.x).
  - Updated the test result with correct results that expose BUG#40037.
sql/sql_select.cc:
  Fixed a memory leak reported by Valgrind.
This commit is contained in:
unknown
2010-10-20 15:43:55 +03:00
parent addd57828d
commit e85a4cb6b5
7 changed files with 3972 additions and 325 deletions

View File

@@ -3403,6 +3403,19 @@ int rewrite_to_index_subquery_engine(JOIN *join)
/*
is this simple IN subquery?
*/
/* TODO: In order to use these more efficient subquery engines in more cases,
the following problems need to be solved:
- the code that removes GROUP BY (group_list), also adds an ORDER BY
(order), thus GROUP BY queries (almost?) never pass through this branch.
Solution: remove the test below '!join->order', because we remove the
ORDER clase for subqueries anyway.
- in order to set a more efficient engine, the optimizer needs to both
decide to remove GROUP BY, *and* select one of the JT_[EQ_]REF[_OR_NULL]
access methods, *and* loose scan should be more expensive or
inapliccable. When is that possible?
- Consider expanding the applicability of this rewrite for loose scan
for group by queries.
*/
if (!join->group_list && !join->order &&
join->unit->item &&
join->unit->item->substype() == Item_subselect::IN_SUBS &&