From: Roy Lyseng Date: June 8 2011 12:48pm Subject: Re: bzr commit into mysql-trunk branch (roy.lyseng:3379) Bug#12316645 List-Archive: http://lists.mysql.com/commits/138840 Message-Id: <4DEF6F88.9030501@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Hi Øystein, On 08.06.11 09.23, Øystein Grøvlen wrote: > Hi, > > Approved. Thank you! > I have one nit-pick: While I generally agree that the ? operator might make > assignments clearer than if statements, I do not think this is particularly > readable: > >> + /* >> + Cannot use join buffering if either >> + 1. Join buffering is disabled by the user, or >> + 2. Outer joined table, and join buffering disabled for outer join, or >> + 3. Semi-joined table, and join buffering disabled for semi-join, or >> + 4. Unlinked cache is forced and there are multiple inner tables of >> + this outer join. >> + */ >> + tab->use_join_cache= >> + (thd->variables.optimizer_join_cache_level == 0 || // 1 >> + ((tab->table->map& join->outer_join)&& // 2 >> + thd->variables.optimizer_join_cache_level<= 2) || // 2 >> + (tab->emb_sj_nest != NULL&& // 3 >> + thd->variables.optimizer_join_cache_level<= 2) || // 3 >> + (force_unlinked_cache&& // 4 >> + tl->in_outer_join_nest()&& // 4 >> + tl->embedding->nested_join->join_list.elements> 1)) ? // 4 >> + JOIN_CACHE::ALG_NONE : // Indicates that join buffering cannot be used >> + JOIN_CACHE::ALG_BNL | JOIN_CACHE::ALG_BKA | JOIN_CACHE::ALG_BKA_UNIQUE; > > When if-statements are that complex this becomes a bit difficult to read, IMHO. > I will take the liberty to be more specific about which join buffering strategies are available. This means, in addition to the tests above: - For JCL >= 1: Enable ALG_BNL - For JCL = 5 or 6: Enable ALG_BKA - For JCL = 7 or 8: Enable ALG_BKA_UNIQUE The information will not be used except for true/false testing, but it may be useful in later modifications to cost calculations when join buffering is involved. > Also, I urge you to in some way document the deficiencies in the cost model that > we discussed in relation to this bug. I will do that to the cost model wiki page that Olav and Jørgen promised to set up. Roy