From: Ole John Aske Date: October 27 2010 9:29pm Subject: bzr push into mysql-5.1-telco-7.0-spj-scan-vs-scan branch (ole.john.aske:3327 to 3328) List-Archive: http://lists.mysql.com/commits/122164 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0078228211==" --===============0078228211== MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline 3328 Ole John Aske 2010-10-27 spj-svs: Addressed some of Johan Andersson comments after testing EXPLAIN EXTENDED on non-pushable queries. 1: Enclose table and column names in quotes in order to better seperate them from rest of the explained text. 2: Add explain of queries being non pushable due to incompatible datatypes. modified: sql/ha_ndbcluster.cc 3327 Jonas Oreland 2010-10-27 ndb spj svs - fix reception of SCAN_HBREP modified: storage/ndb/src/kernel/blocks/dbspj/DbspjInit.cpp === modified file 'sql/ha_ndbcluster.cc' --- a/sql/ha_ndbcluster.cc 2010-10-26 12:41:00 +0000 +++ b/sql/ha_ndbcluster.cc 2010-10-27 21:29:01 +0000 @@ -837,7 +837,7 @@ ndb_pushed_builder_ctx::init_pushability if (table->file->ht != ndbcluster_hton) { m_tables[i].m_maybe_pushable= 0; - EXPLAIN_NO_PUSH("Table %s not in Cluster engine, not pushable", table->alias); + EXPLAIN_NO_PUSH("Table '%s' not in Cluster engine, not pushable", table->alias); continue; } m_tables[i].m_maybe_pushable= static_cast(table->file)->get_pushability(); @@ -864,13 +864,15 @@ ndb_pushed_builder_ctx::is_pushable_as_p if (access_type == AQP::AT_OTHER) { - EXPLAIN_NO_PUSH("Table %s is not pushable, unknown access 'type'", table->get_table()->alias); + EXPLAIN_NO_PUSH("Table '%s' is not pushable, " + "unknown access 'type'", table->get_table()->alias); m_tables[table_no].m_maybe_pushable &= ~PUSHABLE_AS_PARENT; DBUG_RETURN(false); } if (access_type == AQP::AT_MULTI_UNIQUE_KEY) { - EXPLAIN_NO_PUSH("Table %s is not pushable, access type 'MULTI_UNIQUE_KEY' not implemented", + EXPLAIN_NO_PUSH("Table '%s' is not pushable, " + "access type 'MULTI_UNIQUE_KEY' not implemented", table->get_table()->alias); m_tables[table_no].m_maybe_pushable &= ~PUSHABLE_AS_PARENT; DBUG_RETURN(false); @@ -922,7 +924,7 @@ ndb_pushed_builder_ctx::is_pushable_as_c if (!(is_lookup_operation(access_type) || access_type==AQP::AT_ORDERED_INDEX_SCAN)) { - EXPLAIN_NO_PUSH("Can't push table %s as child, 'type' must be a REF access", + EXPLAIN_NO_PUSH("Can't push table '%s' as child, 'type' must be a REF access", table->get_table()->alias); m_tables[tab_no].m_maybe_pushable &= ~PUSHABLE_AS_CHILD; DBUG_RETURN(false); @@ -931,7 +933,8 @@ ndb_pushed_builder_ctx::is_pushable_as_c // Currently there is a limitation in not allowing LOOKUP - (index)SCAN operations if (is_lookup_operation(root_type) && access_type==AQP::AT_ORDERED_INDEX_SCAN) { - EXPLAIN_NO_PUSH("Push of table %s as scan-child with lookup-root %s not implemented", + EXPLAIN_NO_PUSH("Push of table '%s' as scan-child " + "with lookup-root '%s' not implemented", table->get_table()->alias, join_root()->get_table()->alias); // 'table' may still be PUSHABLE_AS_CHILD with another parent DBUG_RETURN(false); @@ -939,7 +942,8 @@ ndb_pushed_builder_ctx::is_pushable_as_c if (table->get_no_of_key_fields() > ndb_pushed_join::MAX_LINKED_KEYS) { - EXPLAIN_NO_PUSH("Can't push table %s as child; to many #REF'ed parent fields", + EXPLAIN_NO_PUSH("Can't push table '%s' as child, " + "to many REF'ed parent fields", table->get_table()->alias); m_tables[tab_no].m_maybe_pushable &= ~PUSHABLE_AS_CHILD; // Permanently dissable DBUG_RETURN(false); @@ -970,9 +974,20 @@ ndb_pushed_builder_ctx::is_pushable_as_c } else if (key_item->type() != Item::FIELD_ITEM) { - DBUG_PRINT("info", (" Item type:%d not join_pushable -> can't append table:%d", - key_item->type(), tab_no+1)); - DBUG_RETURN(false); // TODO, handle gracefull -> continue? + if (key_part_no==0) + { + EXPLAIN_NO_PUSH("Can't push table '%s' as child, " + "column '%s' does neither REF a column nor a constant", + table->get_table()->alias, + table->get_key_part_info(key_part_no)->field->field_name); + m_tables[tab_no].m_maybe_pushable &= ~PUSHABLE_AS_CHILD; // Permanently disable as child + DBUG_RETURN(false); + } + DBUG_RETURN(false); // TODO, gracefull handling below need more testing + + // Else, there was join_items prior to this which was usable + join_items[key_part_no]= NULL; // Terminate usable joined item + break; } const Item_field* const key_item_field @@ -985,8 +1000,22 @@ ndb_pushed_builder_ctx::is_pushable_as_c if (!key_item_field->field ->eq_def(table->get_key_part_info(key_part_no)->field)) { - DBUG_PRINT("info", ("Item_field does not have same definition as REF'ed key")); - DBUG_RETURN(false); // TODO, handle gracefull -> continue? + if (key_part_no==0) + { + EXPLAIN_NO_PUSH("Can't push table '%s' as child, " + "column '%s' does not have same datatype as REF'ed column '%s.%s'", + table->get_table()->alias, + table->get_key_part_info(key_part_no)->field->field_name, + key_item_field->field->table->alias, + key_item_field->field->field_name); + m_tables[tab_no].m_maybe_pushable &= ~PUSHABLE_AS_CHILD; // Permanently disable as child + DBUG_RETURN(false); + } + DBUG_RETURN(false); // TODO, gracefull handling below need more testing + + // Else, there was join_items prior to this which was usable + join_items[key_part_no]= NULL; // Terminate usable joined item + break; } /** @@ -1087,7 +1116,7 @@ ndb_pushed_builder_ctx::is_pushable_as_c } else { - EXPLAIN_NO_PUSH("Can't push table %s as child of %s, " + EXPLAIN_NO_PUSH("Can't push table '%s' as child of '%s', " "Item_field '%s.%s' is outside scope of pushable join", table->get_table()->alias, join_root()->get_table()->alias, get_referred_table_access_name(key_item_field), @@ -1098,25 +1127,20 @@ ndb_pushed_builder_ctx::is_pushable_as_c join_items[table->get_no_of_key_fields()]= NULL; - if (current_parents.is_clear_all()) + if (m_const_scope.contain(current_parents)) { - EXPLAIN_NO_PUSH("Can't push table %s as child; no usable REF'ed parent FIELD_ITEMs", - table->get_table()->alias); - m_tables[tab_no].m_maybe_pushable &= ~PUSHABLE_AS_CHILD; // Permanently disable as child - DBUG_RETURN(false); - } - else if (m_const_scope.contain(current_parents)) - { - // NOTE: This is a constant table wrt. this instance of the pushed join. - // It should be relatively simple to extend the SPJ block to - // allow such tables to be included in the pushed join. - EXPLAIN_NO_PUSH("Can't push table %s as child of %s, their dependency is 'const'", + // NOTE: This is a constant table wrt. this instance of the pushed join. + // It should be relatively simple to extend the SPJ block to + // allow such tables to be included in the pushed join. + EXPLAIN_NO_PUSH("Can't push table '%s' as child of '%s', " + "their dependency is 'const'", table->get_table()->alias, join_root()->get_table()->alias); DBUG_RETURN(false); } else if (parents.is_clear_all()) { - EXPLAIN_NO_PUSH("Can't push table %s as child of %s, no parents found within scope", + EXPLAIN_NO_PUSH("Can't push table '%s' as child of '%s', " + "no parents found within scope", table->get_table()->alias, join_root()->get_table()->alias); DBUG_RETURN(false); } @@ -1164,8 +1188,9 @@ ndb_pushed_builder_ctx::is_pushable_as_c if (scan_descendant->get_join_type(parent) == AQP::JT_OUTER_JOIN) { DBUG_PRINT("info", (" There are outer joins between parent and artificial parent -> can't append")); - EXPLAIN_NO_PUSH("Can't push table %s as child of %s, implementation limitations for outer joins", - table->get_table()->alias, join_root()->get_table()->alias); + EXPLAIN_NO_PUSH("Can't push table '%s' as child of '%s', " + "implementation limitations for outer joins", + table->get_table()->alias, join_root()->get_table()->alias); DBUG_RETURN(false); } parent_no= descendant_no; @@ -1176,8 +1201,11 @@ ndb_pushed_builder_ctx::is_pushable_as_c if (scan_descendant && table->get_join_type(scan_descendant) == AQP::JT_OUTER_JOIN) { - EXPLAIN_NO_PUSH("Can't push table %s as child of %s, outer join with scan-descendant %s not implemented", - table->get_table()->alias, join_root()->get_table()->alias, scan_descendant->get_table()->alias); + EXPLAIN_NO_PUSH("Can't push table '%s' as child of '%s', " + "outer join with scan-descendant '%s' not implemented", + table->get_table()->alias, + join_root()->get_table()->alias, + scan_descendant->get_table()->alias); DBUG_RETURN(false); } } @@ -1195,9 +1223,11 @@ ndb_pushed_builder_ctx::is_pushable_as_c scan_ancestor= m_plan.get_table_access(ancestor_no); if (m_tables[ancestor_no].m_last_scan_descendant < MAX_TABLES) { - EXPLAIN_NO_PUSH("Can't push table %s as child of %s, " - "implementation limitations due to bushy scan with %s indirect through %s", - table->get_table()->alias, join_root()->get_table()->alias, + EXPLAIN_NO_PUSH("Can't push table '%s' as child of '%s', " + "implementation limitations due to bushy scan " + "with '%s' indirect through '%s'", + table->get_table()->alias, + join_root()->get_table()->alias, m_plan.get_table_access(m_tables[ancestor_no].m_last_scan_descendant)->get_table()->alias, scan_ancestor->get_table()->alias); DBUG_RETURN(false); @@ -1216,8 +1246,11 @@ ndb_pushed_builder_ctx::is_pushable_as_c if (scan_ancestor && table->get_join_type(scan_ancestor) == AQP::JT_OUTER_JOIN) { - EXPLAIN_NO_PUSH("Can't push table %s as child of %s, outer join with scan-ancestor %s not implemented", - table->get_table()->alias, join_root()->get_table()->alias, scan_ancestor->get_table()->alias); + EXPLAIN_NO_PUSH("Can't push table '%s' as child of '%s', " + "outer join with scan-ancestor '%s' not implemented", + table->get_table()->alias, + join_root()->get_table()->alias, + scan_ancestor->get_table()->alias); DBUG_RETURN(false); } } @@ -1658,12 +1691,16 @@ ha_ndbcluster::get_pushability() const { if (uses_blob_value(table->read_set)) { - EXPLAIN_NO_PUSH("Table %s not pushable, 'read_set' contain BLOB columns", table->alias); + EXPLAIN_NO_PUSH("Table '%s' not pushable, " + "select list can't contain BLOB columns", + table->alias); return 0; } if (m_user_defined_partitioning) { - EXPLAIN_NO_PUSH("Table %s not pushable, has user defined partioning", table->alias); + EXPLAIN_NO_PUSH("Table '%s' not pushable, " + "has user defined partioning", + table->alias); return 0; } return (ndb_pushed_builder_ctx::PUSHABLE_AS_CHILD | --===============0078228211== MIME-Version: 1.0 Content-Type: text/bzr-bundle; charset="us-ascii"; name="bzr/ole.john.aske@stripped" Content-Transfer-Encoding: 7bit Content-Disposition: inline # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: ole.john.aske@stripped\ # 000ylxxhv33i5956 # target_branch: file:///home/oleja/mysql/mysql-5.1-telco-7.0-spj-\ # scan-scan/ # testament_sha1: cd454bc5c0ed494b025bddb280c0bce33193b9c8 # timestamp: 2010-10-27 23:29:54 +0200 # source_branch: bzr+ssh://oaske@stripped/bzrroot/server\ # /mysql-5.1-telco-7.0-spj/ # base_revision_id: jonas@stripped # # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWbRQDlQABKL/gF0QZ4BT5/// f//+ar////tgCYtwjYdPrt5qb2M72UV1r0dDkNPQGGSTRJ5TJp4UeoPUM9GqbUAyAyGgAAAGgAlE TRNplPTSYppNPU8k0NAADQAAANA0YagSkDQEI0jKeSHqBpkAADIAAADQGgJEQiZEp7JPIyJqeJqM mE09TPVG0QHpMhoGRpoZA40NA0aZGmjTIDEwQAA0BoDTIDAmQJIiGgCnpoJmkNTCek02qZQ02pp6 aj1MRgBBgZSqAedACekSia1FLkBoRCtAoBB4sFh+zOqtO64k6HEMTWUG+PszEyR8R8TWUDLwMwqC pNUBgpXGQwxtuPEE3YO5zNiDW2lFuXFYTVzoLKF6AgZ7+BwAkVBLtjSEaBzUDSxfvvCTP1g9mDhT +yVZ9lz3qrKYjOD06WCbAw9QpzPJr4tMURSkyUYrUcFab80Q2o1uxIRXgutdrGDd7q6PYyet8puB zeXiKarTtGcPp2e61Qvj6q3ZZmgbQWvm5a7pPU60Qql/fq0hQsYFib3zbSLYcEm7vMPuR22BRijZ 0s+jGkCwwcUiPvJ82kie2v8K7DhsELNaMiiWhSrvI+4W1zZkkQViEjUxzMZDclpMWs4UyKiFZrgP cLUYo+dR1pD75SgijEYKpEYPIUbRAA5mno7rd3c2a3wVmxwZ6lXmV/0IDb85SOmYkgiBqXZJG+0G gyoDD1QLKyaABCTOc0goPMgKoVgp2grwjXRqPjx3kKwwhLAXIQ0mQwgG370jb1QyAfoKUqM74uI+ AR2THcVk0DZg2EEaOWZYQIAuM5poCqjJHMFgYHKXYFxSQJUClXLeE88TCUjMJK/knoSOk8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