List:Commits« Previous MessageNext Message »
From:Guilhem Bichot Date:September 21 2010 2:17pm
Subject:Re: bzr commit into mysql-next-mr-bugfixing branch (roy.lyseng:3245)
View as plain text  
Hello,

Roy Lyseng a écrit, Le 21.09.2010 13:41:
> #At file:///home/rl136806/mysql/repo/mysql-review/ based on
> revid:roy.lyseng@stripped
> 
>  3245 Roy Lyseng	2010-09-21
>       Refactoring: Make members positions and best_positions of class JOIN
>       dynamically allocated instead of fixed-size arrays.
>       This saves approx. 20 kbyte memory during optimization and execution
>       for normal-sized join operations.

Good catch!

> === modified file 'sql/sql_select.cc'
> --- a/sql/sql_select.cc	2010-09-20 14:06:02 +0000
> +++ b/sql/sql_select.cc	2010-09-21 11:36:51 +0000
> @@ -4490,6 +4490,14 @@ make_join_statistics(JOIN *join, TABLE_L
>    if (!stat || !stat_ref || !table_vector)
>      DBUG_RETURN(1);				// Eom /* purecov: inspected */
>  
> +  if (!(join->positions=
> +       (POSITION *)join->thd->alloc(sizeof(POSITION)*(table_count+1))))
> +    DBUG_RETURN(TRUE);
> +
> +  if (!(join->best_positions=
> +       (POSITION *)join->thd->alloc(sizeof(POSITION)*(table_count+1))))
> +    DBUG_RETURN(TRUE);
> +

this, or like is done in the previous lines for stat/stat_ref/table_vector:
just do a bunch of
x= join->thd->alloc()
and one final test
if (!x || !y || !z || !t || etc)
   DBUG_RETURN(TRUE);

Ok to push.

As this patch is touching memory allocation and using MEM_ROOT (via 
thd->alloc()), I suggest running all optimizer tests with --ps-protocol 
--valgrind to see whether there's a problem before pushing.
Thanks.
Thread
bzr commit into mysql-next-mr-bugfixing branch (roy.lyseng:3245) Roy Lyseng21 Sep
  • Re: bzr commit into mysql-next-mr-bugfixing branch (roy.lyseng:3245)Guilhem Bichot21 Sep
    • Re: bzr commit into mysql-next-mr-bugfixing branch (roy.lyseng:3245)Roy Lyseng22 Sep
  • Re: bzr commit into mysql-next-mr-bugfixing branch (roy.lyseng:3245)Tor Didriksen21 Sep
    • Re: bzr commit into mysql-next-mr-bugfixing branch (roy.lyseng:3245)Roy Lyseng22 Sep