From: Ole John Aske Date: April 27 2011 8:17am Subject: bzr push into mysql-5.1-telco-7.0-spj-scan-vs-scan branch (ole.john.aske:3480 to 3481) List-Archive: http://lists.mysql.com/commits/136162 Message-Id: <20110427081706.E9E60222@fimafeng09.norway.sun.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3481 Ole John Aske 2011-04-27 SPJ: Remove compiler warning about 'unused parent_no' modified: sql/ha_ndbcluster_push.cc 3480 Ole John Aske 2011-04-27 SPJ: Mayor refactoring of ha_ndbcluster_push.cc and the logic which build the pushed query (or: NdbQueryDef). Previously the NdbQueryDef was build incremenataly as we analyzed the query plan for pushable operations. This had the disadvantage that we could take descission about parent - child relations at this stage which later prevented other child candidates to be appended to the pushed query. This refactoring extends 'class ndb_pushed_builder_ctx' such that it collects intermediate information about pushable operation, and possible parent candidates for each child operation. Furthermore, it breaks the pushability logic into multiple passes: 1 ANALYZE: Analyze each child candidate and add it to 'ndb_pushed_builder_ctx::m_join_scope' as 'pushable' if it qualifies as such. In addition possible parent candidates, and required (forced) parent dependencies are collected for each table. All non pushable operations should be identified during this pass such that only known pushable operations remains. 2 OPTIMIZE: Determine the parent to be used among the set of possible parents. This is decided based on simple heuristic where the goal is to employ conditional filters as soon as possible, reduce the fanout of intermediate results, and utilize the parallelism of the SPJ block whenever considdered optimal. 3 BUILD: Build the NdbQueryDef. The primary goal of this refactoring has been to provide a better platform for later improving the efficiency of the pushed queries being produced. It has not been the goal of this refactoring to change the pushability of any query in the existing MTR testsuite. However a few queries has improved its pushability as the 'analyze' phase now are able to force an artificial sequential dependency between tables which enables more child operations to be appended to the pushed query. modified: mysql-test/suite/ndb/r/ndb_gis.result mysql-test/suite/ndb/r/ndb_join_pushdown.result mysql-test/suite/ndb/t/ndb_join_pushdown.test sql/ha_ndbcluster.cc sql/ha_ndbcluster.h sql/ha_ndbcluster_push.cc sql/ha_ndbcluster_push.h === modified file 'sql/ha_ndbcluster_push.cc' --- a/sql/ha_ndbcluster_push.cc 2011-04-27 07:42:18 +0000 +++ b/sql/ha_ndbcluster_push.cc 2011-04-27 08:16:37 +0000 @@ -1075,9 +1075,6 @@ ndb_pushed_builder_ctx::build_key(const } } - const uint parent_no= m_tables[tab_no].m_parent; - DBUG_ASSERT(parent_no!=MAX_TABLES); - const Item* join_items[ndb_pushed_join::MAX_LINKED_KEYS+1]; collect_key_refs(table,join_items); @@ -1196,6 +1193,7 @@ ndb_pushed_builder_ctx::build_query() } if (table != m_join_root) { + DBUG_ASSERT(m_tables[tab_no].m_parent!=MAX_TABLES); const uint parent_no= m_tables[tab_no].m_parent; const AQP::Table_access* parent= m_plan.get_table_access(parent_no); No bundle (reason: useless for push emails).