List:Internals« Previous MessageNext Message »
From:Jay Pipes Date:September 9 2009 8:15pm
Subject:Re: Contribution: Fix for BUG#42742
View as plain text  
Sergey Petrunya wrote:
> === modified file 'sql/sql_select.cc'
> --- a/sql/sql_select.cc	2009-07-06 07:57:39 +0000
> +++ b/sql/sql_select.cc	2009-07-06 14:33:29 +0000
> @@ -7916,7 +7916,11 @@
>      
>      uint i_end= first + join->best_positions[first].n_sj_tables;
>      for (uint i= first; i < i_end; i++)
> +    {
> +      if (i != first)
> +        join->best_positions[i].sj_strategy= SJ_OPT_NONE;
>        handled_tabs |= join->best_positions[i].table->table->map;
> +    }
>  
>      if (tablenr != first)
>        pos->sj_strategy= SJ_OPT_NONE;

Would it not, then, be best to remove the block:

if (tablenr != first)
   pos->sj_strategy= SJ_OPT_NONE;

?

Also, I believe it would be best (to help future developers) to put a 
short comment in the source code explaining the if() in the for loop. 
Something like:

/* best_positions array is already sorted so that first POSITION in
    array contains the best semijoin strategy.  We remove semijoin
    options for all other positions to ensure only a single semijoin
    strategy is used for each unique table/join set. */

would suffice.

Cheers!

Jay
Thread
Contribution: Fix for BUG#42742Sergey Petrunya9 Sep
  • Re: Contribution: Fix for BUG#42742Jay Pipes9 Sep
  • Re: Contribution: Fix for BUG#42742Masood Mortazavi16 Sep
    • Re: Contribution: Fix for BUG#42742Vladimir Shebordaev16 Sep
      • Re: Contribution: Fix for BUG#42742Giuseppe Maxia16 Sep
    • Re: Contribution: Fix for BUG#42742Kristian Nielsen16 Sep
      • Re: Contribution: Fix for BUG#42742Giuseppe Maxia16 Sep
        • Re: Contribution: Fix for BUG#42742Masood Mortazavi17 Sep