1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge magare.gmz:/home/kgeorge/mysql/work/B27531-5.0-opt

into  magare.gmz:/home/kgeorge/mysql/work/B27531-5.1-opt
This commit is contained in:
gkodinov/kgeorge@magare.gmz
2007-05-04 16:37:30 +03:00
13 changed files with 160 additions and 14 deletions

View File

@ -1436,14 +1436,13 @@ JOIN::optimize()
}
}
if (select_lex->uncacheable && !is_top_level_join())
{
/* If this join belongs to an uncacheable subquery */
if (!(tmp_join= (JOIN*)thd->alloc(sizeof(JOIN))))
DBUG_RETURN(-1);
error= 0; // Ensure that tmp_join.error= 0
restore_tmp();
}
/*
If this join belongs to an uncacheable subquery save
the original join
*/
if (select_lex->uncacheable && !is_top_level_join() &&
init_save_join_tab())
DBUG_RETURN(-1);
}
error= 0;
@ -1505,6 +1504,27 @@ JOIN::reinit()
DBUG_RETURN(0);
}
/**
@brief Save the original join layout
@details Saves the original join layout so it can be reused in
re-execution and for EXPLAIN.
@return Operation status
@retval 0 success.
@retval 1 error occurred.
*/
bool
JOIN::init_save_join_tab()
{
if (!(tmp_join= (JOIN*)thd->alloc(sizeof(JOIN))))
return 1;
error= 0; // Ensure that tmp_join.error= 0
restore_tmp();
return 0;
}
bool
JOIN::save_join_tab()
@ -10768,7 +10788,6 @@ static enum_nested_loop_state
evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
int error, my_bool *report_error)
{
bool not_exists_optimize= join_tab->table->reginfo.not_exists_optimize;
bool not_used_in_distinct=join_tab->not_used_in_distinct;
ha_rows found_records=join->found_records;
COND *select_cond= join_tab->select_cond;
@ -10805,6 +10824,8 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
first_unmatched->found= 1;
for (JOIN_TAB *tab= first_unmatched; tab <= join_tab; tab++)
{
if (tab->table->reginfo.not_exists_optimize)
return NESTED_LOOP_NO_MORE_ROWS;
/* Check all predicates that has just been activated. */
/*
Actually all predicates non-guarded by first_unmatched->found
@ -10850,8 +10871,6 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
if (found)
{
enum enum_nested_loop_state rc;
if (not_exists_optimize)
return NESTED_LOOP_NO_MORE_ROWS;
/* A match from join_tab is found for the current partial join. */
rc= (*join_tab->next_select)(join, join_tab+1, 0);
if (rc != NESTED_LOOP_OK && rc != NESTED_LOOP_NO_MORE_ROWS)