List:Commits« Previous MessageNext Message »
From:Ole John Aske Date:November 17 2010 11:59am
Subject:bzr commit into mysql-5.1-telco-7.0-spj-scan-vs-scan branch
(ole.john.aske:3373)
View as plain text  
#At file:///net/fimafeng09/export/home/tmp/oleja/mysql/mysql-5.1-telco-7.0-spj-scan-scan/ based on revid:ole.john.aske@stripped

 3373 Ole John Aske	2010-11-17
      SPJ-scan-scan: Rework / refactoring of http://lists.mysql.com/commits/124035
      
      Changed the way AQP determines a table to has been 'optimized away, or const'ified by optimizer'

    modified:
      mysql-test/suite/ndb/r/ndb_join_pushdown.result
      sql/abstract_query_plan.cc
      sql/ha_ndbcluster.cc
=== modified file 'mysql-test/suite/ndb/r/ndb_join_pushdown.result'
--- a/mysql-test/suite/ndb/r/ndb_join_pushdown.result	2010-11-16 13:26:19 +0000
+++ b/mysql-test/suite/ndb/r/ndb_join_pushdown.result	2010-11-17 11:59:32 +0000
@@ -2709,7 +2709,7 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	t1	const	PRIMARY	PRIMARY	4	const	1	100.00	
 1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	const	1	100.00	
 Warnings:
-Note	1644	Table 't1' not pushable, select list can't contain BLOB columns
+Note	1644	Table 't1' was optimized away, or const'ified by optimizer
 Note	1003	select '2' AS `a`,'1' AS `b`,'kalle' AS `c`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = '1'))
 select *
 from t1, t2
@@ -4528,7 +4528,7 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	b	system	NULL	NULL	NULL	NULL	1	100.00	
 1	SIMPLE	a	ALL	NULL	NULL	NULL	NULL	4	50.00	
 Warnings:
-Note	1644	Table 'b' was const-table optimized, no runtime access required
+Note	1644	Table 'b' was optimized away, or const'ified by optimizer
 Note	1003	select `test`.`a`.`k` AS `k`,`test`.`a`.`uq` AS `uq`,NULL AS `k`,NULL AS `uq` from `test`.`t` `a` left join `test`.`t` `b` on((isnull(`test`.`a`.`k`) and (`test`.`a`.`uq` = NULL)))
 select * from t as a left join t as b 
 on a.k is null and a.uq=b.uq;

=== modified file 'sql/abstract_query_plan.cc'
--- a/sql/abstract_query_plan.cc	2010-11-16 13:26:19 +0000
+++ b/sql/abstract_query_plan.cc	2010-11-17 11:59:32 +0000
@@ -298,6 +298,16 @@ namespace AQP
       DBUG_VOID_RETURN;
     }
 
+    /* Tables below 'const_tables' has been const'ified, or entirely
+     * optimized away due to 'impossible WHERE/ON'
+     */
+    if (join_tab < join->join_tab+join->const_tables)
+    {
+      DBUG_PRINT("info", ("Operation %d is const-optimized.", m_tab_no));
+      m_access_type= AT_FIXED;
+      DBUG_VOID_RETURN;
+    }
+
     /* First non-const table may provide 'simple' ordering for entire join */
     if (join_tab == join->join_tab+join->const_tables)
     {
@@ -309,11 +319,6 @@ namespace AQP
     */
     switch (join_tab->type)
     {
-    case JT_SYSTEM:
-      DBUG_PRINT("info", ("Operation %d is const-optimized.", m_tab_no));
-      m_access_type= AT_FIXED;
-      break;
-
     case JT_EQ_REF:
     case JT_CONST:
       m_index_no= join_tab->ref.key;

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2010-11-16 13:26:19 +0000
+++ b/sql/ha_ndbcluster.cc	2010-11-17 11:59:32 +0000
@@ -862,7 +862,6 @@ ndb_pushed_builder_ctx::init_pushability
     const AQP::Table_access* const table_access = m_plan.get_table_access(i);
     if (table_access->get_table()->file->ht != ndbcluster_hton)
     {
-      m_tables[i].m_maybe_pushable= 0;
       EXPLAIN_NO_PUSH("Table '%s' not in ndb engine, not pushable", 
                       table_access->get_table()->alias);
       continue;
@@ -875,16 +874,14 @@ ndb_pushed_builder_ctx::init_pushability
       break;
 
     case AQP::AT_FIXED:
-      EXPLAIN_NO_PUSH("Table '%s' was const-table optimized, no runtime access required",
+      EXPLAIN_NO_PUSH("Table '%s' was optimized away, or const'ified by optimizer",
                       table_access->get_table()->alias);
-      m_tables[i].m_maybe_pushable= 0;
       break;
 
     case AQP::AT_OTHER:
       EXPLAIN_NO_PUSH("Table '%s' is not pushable: %s",
                       table_access->get_table()->alias, 
                       table_access->get_other_access_reason());
-      m_tables[i].m_maybe_pushable= 0;
       break;
 
     case AQP::AT_UNDECIDED:
@@ -892,7 +889,6 @@ ndb_pushed_builder_ctx::init_pushability
                       " execution time and '%s' is therefore not pushable.",
                       table_access->get_table()->alias,
                       table_access->get_table()->alias);
-      m_tables[i].m_maybe_pushable= 0;
       break;
   
     default:


Attachment: [text/bzr-bundle] bzr/ole.john.aske@oracle.com-20101117115932-ic60ihx8q8mpn35b.bundle
Thread
bzr commit into mysql-5.1-telco-7.0-spj-scan-vs-scan branch(ole.john.aske:3373) Ole John Aske17 Nov