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

Bug #43029: FORCE INDEX FOR ORDER BY is ignored when join

buffering is used

FORCE INDEX FOR ORDER BY now prevents the optimizer from 
using join buffering. As a result the optimizer can use
indexed access on the first table and doesn't need to 
sort the complete resultset at the end of the statement.
This commit is contained in:
Georgi Kodinov
2009-10-07 18:03:42 +03:00
parent 9226c847f5
commit 1a48dd4e2b
8 changed files with 116 additions and 12 deletions

View File

@@ -1231,13 +1231,22 @@ JOIN::optimize()
(!group_list && tmp_table_param.sum_func_count))
order=0;
// Can't use sort on head table if using row cache
// Can't use sort on head table if using join buffering
if (full_join)
{
if (group_list)
simple_group=0;
if (order)
simple_order=0;
TABLE *stable= (sort_by_table == (TABLE *) 1 ?
join_tab[const_tables].table : sort_by_table);
/*
FORCE INDEX FOR ORDER BY can be used to prevent join buffering when
sorting on the first table.
*/
if (!stable || !stable->force_index_order)
{
if (group_list)
simple_group= 0;
if (order)
simple_order= 0;
}
}
/*