1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Bug #27531: the 4.1 fix.

When checking for applicability of join cache
we must disable its usage only if there is no
temp table in use.
When a temp table is used we can use join
cache (and it will not make the result-set 
unordered) to fill the temp table. The filesort() 
operation is then applied to the data in the temp 
table and hence is not affected by join cache
usage.
Fixed by narrowing the condition for disabling 
join cache to exclude the case where temp table
is used.


mysql-test/r/join.result:
  Bug #27531: test case
mysql-test/t/join.test:
  Bug #27531: test case
sql/sql_select.cc:
  Bug #27531: 
  Disable join cache only if not using temp table
This commit is contained in:
unknown
2007-05-04 16:43:29 +03:00
parent 1a0e3a2858
commit 353b6f26b1
3 changed files with 80 additions and 3 deletions

View File

@@ -3939,14 +3939,17 @@ make_join_readinfo(JOIN *join, uint options)
disable join cache because it will change the ordering of the results.
Code handles sort table that is at any location (not only first after
the const tables) despite the fact that it's currently prohibited.
We must disable join cache if the first non-const table alone is
ordered. If there is a temp table the ordering is done as a last
operation and doesn't prevent join cache usage.
*/
if (!ordered_set &&
(table == join->sort_by_table &&
if (!ordered_set && !join->need_tmp &&
((table == join->sort_by_table &&
(!join->order || join->skip_sort_order ||
test_if_skip_sort_order(tab, join->order, join->select_limit,
1))
) ||
(join->sort_by_table == (TABLE *) 1 && i != join->const_tables))
(join->sort_by_table == (TABLE *) 1 && i != join->const_tables)))
ordered_set= 1;
switch (tab->type) {