List:Internals« Previous MessageNext Message »
From:Øystein Grøvlen Date:February 11 2013 2:19pm
Subject:Re: when propagate_cond_constants will be called?
View as plain text  
On 02/10/13 05:12 PM, Mr. Left wrote:
> Hi, all
> Is there anyone can tell me when the function propagate_cond_constants() will be
> really used? Cause I found after the build_equal_items(), all Item_func::EQ_FUNC
> are transformed to Item_func::MULT_EQUAL_FUNC.
> And the example in mysql internals 8.2.1.1. Constant Propagation, just refer to
> propagate_cond_constants(), but all translate are really finished in build_equal_items().
>
> So I want to know when the function propagate_cond_constants() will really work? It's
> kind of you to supply an example.
> Thank you very much.
>

Hi,

If you look at the result files in the optimizer trace suite of MySQL 
5.6 (mysql-test/suite/opt_trace/r/'), there is at least one example 
where propagate_cond_constants() changes the condition. From 
general_no_prot_all.result:

   "condition_processing": {
     "condition": "WHERE",
     "original_condition": "((`t6`.`d` = ifnull(NULL,NULL)) and 
(<cache>(5) = 1))",
     "steps": [
       {
         "transformation": "equality_propagation",
         "resulting_condition": "((`t6`.`d` = ifnull(NULL,NULL)) and 
(<cache>(5) = 1))"
       },
       {
         "transformation": "constant_propagation",
         "resulting_condition": "((`t6`.`d` = NULL) and (<cache>(5) = 1))"
       },
       {
         "transformation": "trivial_condition_removal",
         "resulting_condition": null
       }
     ] /* steps */
   } /* condition_processing */

Hope this helps,

-- 
Øystein
Thread
when propagate_cond_constants will be called?Mr. Left10 Feb
  • Re: when propagate_cond_constants will be called?Øystein Grøvlen11 Feb