1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge macbook.gmz:/Users/kgeorge/mysql/work/B17212-4.1-opt

into  macbook.gmz:/Users/kgeorge/mysql/work/B17212-5.0-opt
This commit is contained in:
gkodinov/kgeorge@macbook.gmz
2006-07-14 11:20:52 +03:00
3 changed files with 80 additions and 1 deletions

View File

@ -5482,6 +5482,7 @@ make_join_readinfo(JOIN *join, uint options)
uint i;
bool statistics= test(!(join->select_options & SELECT_DESCRIBE));
bool ordered_set= 0;
DBUG_ENTER("make_join_readinfo");
for (i=join->const_tables ; i < join->tables ; i++)
@ -5491,6 +5492,22 @@ make_join_readinfo(JOIN *join, uint options)
tab->read_record.table= table;
tab->read_record.file=table->file;
tab->next_select=sub_select; /* normal select */
/*
Determine if the set is already ordered for ORDER BY, so it can
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.
*/
if (!ordered_set &&
(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))
ordered_set= 1;
switch (tab->type) {
case JT_SYSTEM: // Only happens with left join
table->status=STATUS_NO_RECORD;
@ -5561,10 +5578,11 @@ make_join_readinfo(JOIN *join, uint options)
case JT_ALL:
/*
If previous table use cache
If the incoming data set is already sorted don't use cache.
*/
table->status=STATUS_NO_RECORD;
if (i != join->const_tables && !(options & SELECT_NO_JOIN_CACHE) &&
tab->use_quick != 2 && !tab->first_inner)
tab->use_quick != 2 && !tab->first_inner && !ordered_set)
{
if ((options & SELECT_DESCRIBE) ||
!join_init_cache(join->thd,join->join_tab+join->const_tables,