List:Commits« Previous MessageNext Message »
From:Jorgen Loland Date:March 1 2012 12:26pm
Subject:bzr push into mysql-trunk branch (jorgen.loland:3711 to 3712) WL#6158
View as plain text  
 3712 Jorgen Loland	2012-03-01
      WL#6158 followup 
      
      * Rename variable Opt_partial_plans to Last_query_partial_plans.
      * Reset the variable for each query so that it works similar
        to Last_query_cost
      * It does not make sense to have a global version of this 
        variable.
     @ mysql-test/include/print_greedy_search_count.inc
        Rename Opt_partial_plans to Last_query_partial_plans
     @ mysql-test/r/greedy_search.result
        Rename Opt_partial_plans to Last_query_partial_plans
     @ sql/mysqld.cc
        Rename Opt_partial_plans to Last_query_partial_plans
     @ sql/sql_class.h
        Rename Opt_partial_plans to Last_query_partial_plans
        Move the variable to after last_system_status_var in
        system_status_var so that a global version of the variable 
        is not modified.
     @ sql/sql_parse.cc
        Reset Last_query_partial_plans variable for each query.
     @ sql/sql_planner.cc
        Rename Opt_partial_plans to Last_query_partial_plans

    modified:
      mysql-test/include/print_greedy_search_count.inc
      mysql-test/r/greedy_search.result
      sql/mysqld.cc
      sql/sql_class.h
      sql/sql_parse.cc
      sql/sql_planner.cc
 3711 Tor Didriksen	2012-03-01
      Bug#13783777 CONSTANT PROPAGATION IS WRONG FOR DISJUNCTIVE PREDICATES IN VIEWS
      
      This predicate: pk > 8 OR ((pk BETWEEN 9 AND 13) AND pk = 90)
      was optimized into : (90 > 8)
      
      The reason is sharing of the underlying Item_field.
      Solution: disable equality propagation for views.
     @ mysql-test/r/join.result
        One execution plan modification.
     @ mysql-test/r/view.result
        New test case.
     @ mysql-test/t/view.test
        New test case.
     @ sql/item.h
        Implement Item_direct_view_ref::subst_argument_checker()

    modified:
      mysql-test/r/join.result
      mysql-test/r/view.result
      mysql-test/t/view.test
      sql/item.h
=== modified file 'mysql-test/include/print_greedy_search_count.inc'
--- a/mysql-test/include/print_greedy_search_count.inc	2012-02-23 11:22:34 +0000
+++ b/mysql-test/include/print_greedy_search_count.inc	2012-03-01 12:25:52 +0000
@@ -19,7 +19,7 @@
 eval EXPLAIN $query;
 
 let $greedy_search_partial_plans=
-  query_get_value(SHOW STATUS LIKE 'Opt_partial_plans', Value, 1);
+  query_get_value(SHOW STATUS LIKE 'Last_query_partial_plans', Value, 1);
 
---echo ### Opt_partial_plans: $greedy_search_partial_plans
+--echo ### Partial_plans: $greedy_search_partial_plans
 FLUSH STATUS;

=== modified file 'mysql-test/r/greedy_search.result'
--- a/mysql-test/r/greedy_search.result	2012-02-29 11:17:52 +0000
+++ b/mysql-test/r/greedy_search.result	2012-03-01 12:25:52 +0000
@@ -43,7 +43,7 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	countries	eq_ref	PRIMARY	PRIMARY	4	test.vehicles.assembled_in	1	NULL
 1	SIMPLE	models	eq_ref	PRIMARY,brand_id	PRIMARY	4	test.vehicles.model_id	1	Using where
 1	SIMPLE	brands	eq_ref	PRIMARY	PRIMARY	4	test.models.brand_id	1	NULL
-### Opt_partial_plans: 50922
+### Partial_plans: 50922
 FLUSH STATUS;
 #
 # 16-way join - 10 fact tables joined on column with key and
@@ -83,7 +83,7 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	countries	eq_ref	PRIMARY	PRIMARY	4	test.vehicles.assembled_in	1	NULL
 1	SIMPLE	subtypes	eq_ref	PRIMARY	PRIMARY	4	test.vehicles.subtype_id	1	NULL
 1	SIMPLE	colors	eq_ref	PRIMARY	PRIMARY	4	test.vehicles.color_id	1	NULL
-### Opt_partial_plans: 483932
+### Partial_plans: 483932
 FLUSH STATUS;
 select @@optimizer_search_depth;
 @@optimizer_search_depth
@@ -118,7 +118,7 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	t10_7	eq_ref	PRIMARY,colidx	PRIMARY	4	test.t100_6.colidx	1	Using where
 1	SIMPLE	t100_7	eq_ref	PRIMARY,colidx	PRIMARY	4	test.t10_7.colidx	1	Using where
 1	SIMPLE	t10_8	eq_ref	PRIMARY	PRIMARY	4	test.t100_7.colidx	1	NULL
-### Opt_partial_plans: 3669
+### Partial_plans: 3630
 FLUSH STATUS;
 #
 # Chain test b: (...,col):(colidx, col):(pk,col):(colidx,col):(pk,...)
@@ -140,7 +140,7 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	t10_7	eq_ref	PRIMARY	PRIMARY	4	test.t100_6.col	1	Using where
 1	SIMPLE	t100_7	ref	colidx	colidx	5	test.t10_7.col	10	Using where
 1	SIMPLE	t10_8	eq_ref	PRIMARY	PRIMARY	4	test.t100_7.col	1	NULL
-### Opt_partial_plans: 692133
+### Partial_plans: 692133
 FLUSH STATUS;
 #
 # Chain test c: (...,colidx):(col, pk):(col,colidx):(col,...)
@@ -162,7 +162,7 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	t10_2	ref	colidx	colidx	5	test.t100_2.col	1	Using where
 1	SIMPLE	t100_1	eq_ref	PRIMARY	PRIMARY	4	test.t10_2.col	1	Using where
 1	SIMPLE	t10_1	ref	colidx	colidx	5	test.t100_1.col	1	NULL
-### Opt_partial_plans: 12025
+### Partial_plans: 12025
 FLUSH STATUS;
 #
 # Chain test d: (...,colidx):(pk, col):(pk,colidx):(pk,col):(pk,...)
@@ -184,7 +184,7 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	t10_7	eq_ref	PRIMARY,colidx	PRIMARY	4	test.t100_6.col	1	Using where
 1	SIMPLE	t100_7	eq_ref	PRIMARY	PRIMARY	4	test.t10_7.colidx	1	Using where
 1	SIMPLE	t10_8	eq_ref	PRIMARY	PRIMARY	4	test.t100_7.col	1	NULL
-### Opt_partial_plans: 1445
+### Partial_plans: 1445
 FLUSH STATUS;
 #
 # Cleanup after TEST 2

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2012-03-01 10:44:16 +0000
+++ b/sql/mysqld.cc	2012-03-01 12:25:52 +0000
@@ -7206,6 +7206,7 @@ SHOW_VAR status_vars[]= {
   {"Key_write_requests",       (char*) offsetof(KEY_CACHE, global_cache_w_requests), SHOW_KEY_CACHE_LONGLONG},
   {"Key_writes",               (char*) offsetof(KEY_CACHE, global_cache_write), SHOW_KEY_CACHE_LONGLONG},
   {"Last_query_cost",          (char*) offsetof(STATUS_VAR, last_query_cost), SHOW_DOUBLE_STATUS},
+  {"Last_query_partial_plans", (char*) offsetof(STATUS_VAR, last_query_partial_plans), SHOW_LONGLONG_STATUS},
   {"Max_used_connections",     (char*) &max_used_connections,  SHOW_LONG},
   {"Not_flushed_delayed_rows", (char*) &delayed_rows_in_use,    SHOW_LONG_NOFLUSH},
   {"Open_files",               (char*) &my_file_opened,         SHOW_LONG_NOFLUSH},
@@ -7215,7 +7216,6 @@ SHOW_VAR status_vars[]= {
   {"Opened_files",             (char*) &my_file_total_opened, SHOW_LONG_NOFLUSH},
   {"Opened_tables",            (char*) offsetof(STATUS_VAR, opened_tables), SHOW_LONGLONG_STATUS},
   {"Opened_table_definitions", (char*) offsetof(STATUS_VAR, opened_shares), SHOW_LONGLONG_STATUS},
-  {"Opt_partial_plans",        (char*) offsetof(STATUS_VAR, opt_partial_plans), SHOW_LONGLONG_STATUS},
   {"Prepared_stmt_count",      (char*) &show_prepared_stmt_count, SHOW_FUNC},
 #ifdef HAVE_QUERY_CACHE
   {"Qcache_free_blocks",       (char*) &query_cache.free_memory_blocks, SHOW_LONG_NOFLUSH},

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2012-02-29 11:17:52 +0000
+++ b/sql/sql_class.h	2012-03-01 12:25:52 +0000
@@ -842,7 +842,6 @@ typedef struct system_status_var
 {
   ulonglong created_tmp_disk_tables;
   ulonglong created_tmp_tables;
-  ulonglong opt_partial_plans;
   ulonglong ha_commit_count;
   ulonglong ha_delete_count;
   ulonglong ha_read_first_count;
@@ -904,6 +903,7 @@ typedef struct system_status_var
     automatically by add_to_status()/add_diff_to_status().
   */
   double last_query_cost;
+  ulonglong last_query_partial_plans;
 } STATUS_VAR;
 
 /*

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2012-02-28 14:40:36 +0000
+++ b/sql/sql_parse.cc	2012-03-01 12:25:52 +0000
@@ -2378,6 +2378,7 @@ mysql_execute_command(THD *thd)
   case SQLCOM_SELECT:
   {
     thd->status_var.last_query_cost= 0.0;
+    thd->status_var.last_query_partial_plans= 0;
 
     if ((res= select_precheck(thd, lex, all_tables, first_table)))
       break;

=== modified file 'sql/sql_planner.cc'
--- a/sql/sql_planner.cc	2012-02-23 11:22:34 +0000
+++ b/sql/sql_planner.cc	2012-03-01 12:25:52 +0000
@@ -1789,7 +1789,7 @@ bool Optimize_table_order::best_extensio
 
   for (JOIN_TAB **pos= join->best_ref + idx; *pos; pos++)
   {
-    status_var_increment(thd->status_var.opt_partial_plans);
+    status_var_increment(thd->status_var.last_query_partial_plans);
     JOIN_TAB *const s= *pos;
     const table_map real_table_bit= s->table->map;
 
@@ -2158,7 +2158,7 @@ table_map Optimize_table_order::eq_ref_e
                           added_to_eq_ref_extension);
       if (added_to_eq_ref_extension)
       {
-        status_var_increment(thd->status_var.opt_partial_plans);
+        status_var_increment(thd->status_var.last_query_partial_plans);
         double current_record_count, current_read_time;
 
         /* Add the cost of extending the plan with 's' */

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (jorgen.loland:3711 to 3712) WL#6158Jorgen Loland5 Mar