From: Jan Wedvik Date: June 24 2011 12:32pm Subject: bzr commit into mysql-5.1-telco-7.0-spj-scan-vs-scan branch (jan.wedvik:3517) List-Archive: http://lists.mysql.com/commits/139821 Message-Id: <20110624123220.60230225@fimafeng09.norway.sun.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit #At file:///net/atum17/export/home/tmp/jw159207/mysql/repo/push-scan-scan/ based on revid:jan.wedvik@stripped 3517 Jan Wedvik 2011-06-24 [merge] Merged from mysql-5.1-telco-7.0 . added: mysql-test/suite/ndb/r/ndb_row_count.result mysql-test/suite/ndb/t/ndb_row_count.test modified: mysql-test/suite/ndb/r/ndb_condition_pushdown.result mysql-test/suite/ndb/r/ndb_index_unique.result mysql-test/suite/ndb/r/ndb_join_pushdown.result sql/ha_ndbcluster.cc sql/ha_ndbcluster.h storage/ndb/src/kernel/blocks/dbspj/Dbspj.hpp storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp === modified file 'mysql-test/suite/ndb/r/ndb_condition_pushdown.result' --- a/mysql-test/suite/ndb/r/ndb_condition_pushdown.result 2011-04-10 17:32:41 +0000 +++ b/mysql-test/suite/ndb/r/ndb_condition_pushdown.result 2011-06-24 12:32:05 +0000 @@ -1738,7 +1738,7 @@ pk1 attr1 attr2 attr3 pk1 attr1 attr2 at explain select * from t4 where attr1 < 5 and attr2 > 9223372036854775803 and attr3 != 3 order by t4.pk1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 index attr1 PRIMARY 4 NULL # Using where with pushed condition +1 SIMPLE t4 range attr1 attr1 4 NULL # Using where with pushed condition; Using filesort select * from t4 where attr1 < 5 and attr2 > 9223372036854775803 and attr3 != 3 order by t4.pk1; pk1 attr1 attr2 attr3 attr4 2 2 9223372036854775804 2 c @@ -1910,7 +1910,7 @@ insert into NodeAlias VALUES(null, 8 , ' 12:22:26'); explain select * from NodeAlias where (aliasKey LIKE '491803%'); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NodeAlias range NodeAlias_KeyIndex NodeAlias_KeyIndex 48 NULL 2 Using where with pushed condition +1 SIMPLE NodeAlias range NodeAlias_KeyIndex NodeAlias_KeyIndex 48 NULL 3 Using where with pushed condition select * from NodeAlias where (aliasKey LIKE '491803%') order by id; id nodeId displayName aliasKey objectVersion changed 7 8 491803% 491803% 0 2008-03-10 12:22:26 @@ -2105,46 +2105,46 @@ pk x set engine_condition_pushdown = on; explain select * from t where x <> "aa"; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t ALL NULL NULL NULL NULL 1 Using where +1 SIMPLE t ALL NULL NULL NULL NULL 2 Using where select * from t where x <> "aa"; pk x 0 a explain select * from t where "aa" <> x; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t ALL NULL NULL NULL NULL 1 Using where +1 SIMPLE t ALL NULL NULL NULL NULL 2 Using where select * from t where "aa" <> x; pk x 0 a explain select * from t where x between "" and "bb"; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t ALL NULL NULL NULL NULL 1 Using where +1 SIMPLE t ALL NULL NULL NULL NULL 2 Using where select * from t where x between "" and "bb"; pk x 0 a explain select * from t where x not between "" and "bb"; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t ALL NULL NULL NULL NULL 1 Using where +1 SIMPLE t ALL NULL NULL NULL NULL 2 Using where select * from t where x not between "" and "bb"; pk x explain select * from t where x in ("","aa","b"); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t ALL NULL NULL NULL NULL 1 Using where +1 SIMPLE t ALL NULL NULL NULL NULL 2 Using where select * from t where x in ("","aa","b"); pk x explain select * from t where x not in ("","aa","b"); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t ALL NULL NULL NULL NULL 1 Using where +1 SIMPLE t ALL NULL NULL NULL NULL 2 Using where select * from t where x not in ("","aa","b"); pk x 0 a explain select * from t where x like "aa?"; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t ALL NULL NULL NULL NULL 1 Using where with pushed condition +1 SIMPLE t ALL NULL NULL NULL NULL 2 Using where with pushed condition select * from t where x like "aa?"; pk x explain select * from t where x not like "aa?"; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t ALL NULL NULL NULL NULL 1 Using where with pushed condition +1 SIMPLE t ALL NULL NULL NULL NULL 2 Using where with pushed condition select * from t where x not like "aa?"; pk x 0 a @@ -2201,7 +2201,7 @@ explain extended select * from t where exists (select * from t as subq where subq.i=3 and t.i=3); id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t ALL NULL NULL NULL NULL 4 50.00 Using where +1 PRIMARY t ALL NULL NULL NULL NULL 4 100.00 Using where 2 DEPENDENT SUBQUERY subq ALL NULL NULL NULL NULL 4 100.00 Using where with pushed condition: (`test`.`subq`.`i` = 3) Warnings: Note 1276 Field or reference 'test.t.i' of SELECT #2 was resolved in SELECT #1 @@ -2211,7 +2211,7 @@ select * from t where exists (select * from subq where subq.i=3 and t.i=3); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t ALL NULL NULL NULL NULL 4 100.00 Using where -2 DEPENDENT SUBQUERY subq ALL NULL NULL NULL NULL 4 50.00 Using where with pushed condition: (`test`.`subq`.`i` = 3) +2 DEPENDENT SUBQUERY subq ALL NULL NULL NULL NULL 4 100.00 Using where with pushed condition: (`test`.`subq`.`i` = 3) Warnings: Note 1276 Field or reference 'test.t.i' of SELECT #2 was resolved in SELECT #1 Note 1003 select `test`.`t`.`pk` AS `pk`,`test`.`t`.`i` AS `i` from `test`.`t` where exists(select 1 from `test`.`subq` where ((`test`.`subq`.`i` = 3) and (`test`.`t`.`i` = 3))) @@ -2233,8 +2233,8 @@ primary key (`a`,`b`) ) engine = ndb; explain extended select * from tx join tx as t2 on tx.c=1 where t2.c=1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE tx ALL NULL NULL NULL NULL 0 0.00 Using where with pushed condition: (`test`.`tx`.`c` = 1) -1 SIMPLE t2 ALL NULL NULL NULL NULL 0 0.00 Using where with pushed condition: (`test`.`t2`.`c` = 1); Using join buffer +1 SIMPLE tx ALL NULL NULL NULL NULL 2 100.00 Using where with pushed condition: (`test`.`tx`.`c` = 1) +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where with pushed condition: (`test`.`t2`.`c` = 1); Using join buffer Warnings: Note 1644 Can't push table 't2' as child, 'type' must be a 'ref' access Note 1003 select `test`.`tx`.`a` AS `a`,`test`.`tx`.`b` AS `b`,`test`.`tx`.`c` AS `c`,`test`.`tx`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`tx` join `test`.`tx` `t2` where ((`test`.`tx`.`c` = 1) and (`test`.`t2`.`c` = 1)) @@ -2245,7 +2245,7 @@ join tx as t2 on t2.a = tx.a and t2.b = join tx as t3 on t3.a = tx.c and t3.b = tx.d join tx as t4 on t4.a = t3.b and t4.b = t2.c; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE tx ALL PRIMARY NULL NULL NULL 0 0.00 Parent of 4 pushed join@1 +1 SIMPLE tx ALL PRIMARY NULL NULL NULL 2 100.00 Parent of 4 pushed join@1 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 8 test.tx.a,test.tx.b 1 100.00 Child of 'tx' in pushed join@1 1 SIMPLE t3 eq_ref PRIMARY PRIMARY 8 test.tx.c,test.tx.d 1 100.00 Child of 'tx' in pushed join@1 1 SIMPLE t4 eq_ref PRIMARY PRIMARY 8 test.tx.d,test.t2.c 1 100.00 Child of 't2' in pushed join@1 @@ -2266,8 +2266,8 @@ Note 1644 Table 'tx' is not pushable: GR Note 1003 select `test`.`t2`.`c` AS `c`,count(distinct `test`.`t2`.`a`) AS `count(distinct t2.a)` from `test`.`tx` join `test`.`tx` `t2` where ((`test`.`tx`.`b` = `test`.`t2`.`d`) and (`test`.`tx`.`a` = `test`.`t2`.`c`) and (`test`.`t2`.`a` = 4)) group by `test`.`t2`.`c` explain extended select * from tx join tx as t2 on tx.c=1 where t2.c=1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE tx ALL NULL NULL NULL NULL 0 0.00 Using where with pushed condition: (`test`.`tx`.`c` = 1) -1 SIMPLE t2 ALL NULL NULL NULL NULL 0 0.00 Using where with pushed condition: (`test`.`t2`.`c` = 1); Using join buffer +1 SIMPLE tx ALL NULL NULL NULL NULL 2 100.00 Using where with pushed condition: (`test`.`tx`.`c` = 1) +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where with pushed condition: (`test`.`t2`.`c` = 1); Using join buffer Warnings: Note 1644 Can't push table 't2' as child, 'type' must be a 'ref' access Note 1003 select `test`.`tx`.`a` AS `a`,`test`.`tx`.`b` AS `b`,`test`.`tx`.`c` AS `c`,`test`.`tx`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`tx` join `test`.`tx` `t2` where ((`test`.`tx`.`c` = 1) and (`test`.`t2`.`c` = 1)) @@ -2307,7 +2307,7 @@ explain extended select * from t where exists (select * from t as subq where subq.i=3 and t.i=3); id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t ALL NULL NULL NULL NULL 4 50.00 Using where +1 PRIMARY t ALL NULL NULL NULL NULL 4 100.00 Using where 2 DEPENDENT SUBQUERY subq ALL NULL NULL NULL NULL 4 100.00 Using where with pushed condition: (`test`.`subq`.`i` = 3) Warnings: Note 1276 Field or reference 'test.t.i' of SELECT #2 was resolved in SELECT #1 @@ -2317,7 +2317,7 @@ select * from t where exists (select * from subq where subq.i=3 and t.i=3); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t ALL NULL NULL NULL NULL 4 100.00 Using where -2 DEPENDENT SUBQUERY subq ALL NULL NULL NULL NULL 4 50.00 Using where with pushed condition: (`test`.`subq`.`i` = 3) +2 DEPENDENT SUBQUERY subq ALL NULL NULL NULL NULL 4 100.00 Using where with pushed condition: (`test`.`subq`.`i` = 3) Warnings: Note 1276 Field or reference 'test.t.i' of SELECT #2 was resolved in SELECT #1 Note 1003 select `test`.`t`.`pk` AS `pk`,`test`.`t`.`i` AS `i` from `test`.`t` where exists(select 1 from `test`.`subq` where ((`test`.`subq`.`i` = 3) and (`test`.`t`.`i` = 3))) === modified file 'mysql-test/suite/ndb/r/ndb_index_unique.result' --- a/mysql-test/suite/ndb/r/ndb_index_unique.result 2011-02-28 12:25:52 +0000 +++ b/mysql-test/suite/ndb/r/ndb_index_unique.result 2011-06-24 12:32:05 +0000 @@ -185,7 +185,7 @@ set @old_ecpd = @@session.engine_conditi set engine_condition_pushdown = true; explain select * from t2 where (b = 3 OR b = 5) AND c IS NULL AND a < 9 order by a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range PRIMARY,b PRIMARY 4 NULL 2 Using where with pushed condition +1 SIMPLE t2 range PRIMARY,b b 9 NULL 2 Using where with pushed condition; Using filesort select * from t2 where (b = 3 OR b = 5) AND c IS NULL AND a < 9 order by a; a b c 3 3 NULL === modified file 'mysql-test/suite/ndb/r/ndb_join_pushdown.result' --- a/mysql-test/suite/ndb/r/ndb_join_pushdown.result 2011-06-23 13:26:22 +0000 +++ b/mysql-test/suite/ndb/r/ndb_join_pushdown.result 2011-06-24 12:32:05 +0000 @@ -26,7 +26,7 @@ select * from t1 join t1 as t2 on t2.a = t1.b and t2.b = t1.c; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 16 12.50 Parent of 2 pushed join@1 +1 SIMPLE t1 ALL NULL NULL NULL NULL 16 100.00 Parent of 2 pushed join@1 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1 Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t2`.`b` = `test`.`t1`.`c`) and (`test`.`t2`.`a` = `test`.`t1`.`b`)) @@ -2106,7 +2106,7 @@ from t1, t1 as t2 where t1.a in (1,3,5) and t2.a = t1.b; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 66.67 Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`t1`.`a` in (1,3,5)) +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`t1`.`a` in (1,3,5)) 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Child of 't1' in pushed join@1 Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` in (1,3,5))) @@ -2129,7 +2129,7 @@ from t1, t1 as t2 where t1.a in (1,3,5) and t2.a = t1.b; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 66.67 Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`t1`.`a` in (1,3,5)) +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`t1`.`a` in (1,3,5)) 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Child of 't1' in pushed join@1 Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` in (1,3,5))) @@ -2182,7 +2182,7 @@ insert into t3_hash values (0x3f, 0x1f, explain extended select * from t3 x, t3 y, t1 where y.a3=x.d3 and y.b3=x.b3 and t1.a = y.d3; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ALL NULL NULL NULL NULL 3 66.67 Parent of 3 pushed join@1 +1 SIMPLE x ALL NULL NULL NULL NULL 3 100.00 Parent of 3 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 8 test.x.d3,test.x.b3 1 100.00 Child of 'x' in pushed join@1 1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.y.d3 1 100.00 Child of 'y' in pushed join@1 Warnings: @@ -2220,7 +2220,7 @@ a3 b3 c3 d3 a3 b3 c3 d3 a3 b3 c3 d3 a3 b explain extended select straight_join * from t1 x, t1 y where y.a=0x1f and x.b = 0x1f; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ALL NULL NULL NULL NULL 3 66.67 Using where with pushed condition: (`test`.`x`.`b` = 0x1f) +1 SIMPLE x ALL NULL NULL NULL NULL 3 100.00 Using where with pushed condition: (`test`.`x`.`b` = 0x1f) 1 SIMPLE y const PRIMARY PRIMARY 4 const 1 100.00 Warnings: Note 1644 Can't push table 'y' as child of 'x', their dependency is 'const' @@ -2360,7 +2360,7 @@ insert into t3_unq values (1003, 0x3f, 0 explain extended select * from t3 x, t3 y where y.a3=x.d3 and y.b3=x.b3; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ALL PRIMARY NULL NULL NULL 3 66.67 Parent of 2 pushed join@1 +1 SIMPLE x ALL PRIMARY NULL NULL NULL 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 8 test.x.b3,test.x.d3 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = `test`.`x`.`b3`) and (`test`.`y`.`a3` = `test`.`x`.`d3`)) @@ -2372,7 +2372,7 @@ a3 b3 c3 d3 a3 b3 c3 d3 explain extended select * from t3_hash x, t3_hash y where y.a3=x.d3 and y.b3=x.b3; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ALL PRIMARY NULL NULL NULL 3 66.67 Parent of 2 pushed join@1 +1 SIMPLE x ALL PRIMARY NULL NULL NULL 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 8 test.x.b3,test.x.d3 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3_hash` `x` join `test`.`t3_hash` `y` where ((`test`.`y`.`b3` = `test`.`x`.`b3`) and (`test`.`y`.`a3` = `test`.`x`.`d3`)) @@ -2384,7 +2384,7 @@ a3 b3 c3 d3 a3 b3 c3 d3 explain extended select * from t3_unq x, t3_unq y where y.a3=x.d3 and y.b3=x.b3; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ALL b3 NULL NULL NULL 3 66.67 Parent of 2 pushed join@1 +1 SIMPLE x ALL b3 NULL NULL NULL 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref b3 b3 8 test.x.b3,test.x.d3 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select `test`.`x`.`pk` AS `pk`,`test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`pk` AS `pk`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3_unq` `x` join `test`.`t3_unq` `y` where ((`test`.`y`.`b3` = `test`.`x`.`b3`) and (`test`.`y`.`a3` = `test`.`x`.`d3`)) @@ -2441,7 +2441,7 @@ select * from t3 as t1 left outer join t3 as t2 on t2.d3 = t1.d3 left outer join t3 as t3 on t3.a3 = t2.d3; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 50.00 Parent of 3 pushed join@1 +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Parent of 3 pushed join@1 1 SIMPLE t2 ref d3 d3 5 test.t1.d3 1 100.00 Child of 't1' in pushed join@1 1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.d3 1 100.00 Child of 't2' in pushed join@1 Warnings: @@ -2539,7 +2539,7 @@ explain extended select straight_join * from t3 as x join t3 as y on x.b3 = y.b3; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ALL b3 NULL NULL NULL 7 28.57 Parent of 2 pushed join@1 +1 SIMPLE x ALL b3 NULL NULL NULL 7 100.00 Parent of 2 pushed join@1 1 SIMPLE y ref b3 b3 4 test.x.b3 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select straight_join `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where (`test`.`y`.`b3` = `test`.`x`.`b3`) @@ -2937,12 +2937,12 @@ select * from t1, t2, t1 as t3 where t2.a = t1.b and t3.a = t2.b; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 50.00 -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 +1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer 1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.b 1 100.00 Warnings: Note 1644 Table 't2' not in ndb engine, not pushable -Note 1644 Can't push table 't3' as child of 't1', column 't2.b' is outside scope of pushable join +Note 1644 Cannot push table 't3' as child of table 't1'. Doing so would prevent using join buffer for table 't2'. Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t1` `t3` where ((`test`.`t3`.`a` = `test`.`t2`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`b`)) select * from t1, t2, t1 as t3 where t2.a = t1.b @@ -2969,7 +2969,7 @@ select t1.a, t1.b, t2.a, t2.b from t1, t2 where t2.a = t1.b; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 50.00 Parent of 2 pushed join@1 +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Parent of 2 pushed join@1 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Child of 't1' in pushed join@1 Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`a` = `test`.`t1`.`b`) @@ -3002,7 +3002,7 @@ select t1.a, t1.b, t2.a, t2.b from t1, t2 where t1.a = t2.b; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 50.00 Parent of 2 pushed join@1 +1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00 Parent of 2 pushed join@1 1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.b 1 100.00 Child of 't2' in pushed join@1 Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`b`) @@ -3109,7 +3109,7 @@ insert into t3 values (0x3f, 0x1f, 3, 0x explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3="63"; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 5 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f) and (`test`.`y`.`b3` = '63')) @@ -3125,7 +3125,7 @@ insert into t3 values (0x3f, 0x1f, 3, 0x explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 5 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = (60 + 3)) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f)) @@ -3141,7 +3141,7 @@ insert into t3 values (0x3f, 0x1f, 3, 0x explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 6 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = (60 + 3)) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f)) @@ -3157,7 +3157,7 @@ insert into t3 values (0x3f, 0x1f, 3, 0x explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 6 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = (60 + 3)) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f)) @@ -3173,7 +3173,7 @@ insert into t3 values (0x3f, 0x1f, 3, 0x explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 7 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = (60 + 3)) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f)) @@ -3189,7 +3189,7 @@ insert into t3 values (0x3f, 0x1f, 3, 0x explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 7 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = (60 + 3)) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f)) @@ -3205,7 +3205,7 @@ insert into t3 values (0x3f, 0x1f, 3, 0x explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 8 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = (60 + 3)) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f)) @@ -3221,7 +3221,7 @@ insert into t3 values (0x3f, 0x1f, 3, 0x explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 8 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = (60 + 3)) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f)) @@ -3237,7 +3237,7 @@ insert into t3 values (0x3f, 0x1f, 3, 0x explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 12 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = 63) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f)) @@ -3253,7 +3253,7 @@ insert into t3 values (0x3f, 0x1f, 3, 0x explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 12 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = 63) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f)) @@ -3269,7 +3269,7 @@ insert into t3 values (0x3f, 0, 3, 0x3f) explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 5 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = 1) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f)) @@ -3285,7 +3285,7 @@ insert into t3 values (0x3f, 0.50, 3, 0x explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.0; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 8 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1; Using where with pushed condition: (`test`.`y`.`b3` = 3.0) Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f) and (`test`.`y`.`b3` = 3.0)) @@ -3301,7 +3301,7 @@ insert into t3 values (0x3f, 0.50, 3, 0x explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.0; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 8 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1; Using where with pushed condition: (`test`.`y`.`b3` = 3.0) Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f) and (`test`.`y`.`b3` = 3.0)) @@ -3317,7 +3317,7 @@ insert into t3 values (0x3f, 0.50, 3, 0x explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.14; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 12 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f) and (`test`.`y`.`b3` = 3.14)) @@ -3333,7 +3333,7 @@ insert into t3 values (0x3f, 0.50, 3, 0x explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.14; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 12 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f) and (`test`.`y`.`b3` = 3.14)) @@ -3349,7 +3349,7 @@ insert into t3 values (0x3f, 0x1f, 3, 0x explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=63; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 9 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f) and (`test`.`y`.`b3` = 63)) @@ -3365,7 +3365,7 @@ insert into t3 values (0x3f, 0.50, 3, 0x explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.14; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 10 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = 3.14) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f)) @@ -3381,7 +3381,7 @@ insert into t3 values (0x3f, '2000-02-29 explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='2000-02-28'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 7 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = '2000-02-28') and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f)) @@ -3397,7 +3397,7 @@ insert into t3 values (0x3f, '2000-02-29 explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='2000-02-28 23:59'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 12 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = '2000-02-28 23:59') and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f)) @@ -3413,7 +3413,7 @@ insert into t3 values (0x3f, '12:59:59', explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='23:59'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 7 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f) and (`test`.`y`.`b3` = 235900)) @@ -3429,7 +3429,7 @@ insert into t3 values (0x3f, 'Doffen', 2 explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 20 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1; Using where with pushed condition: (`test`.`y`.`b3` = 'Dole') Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = 'Dole') and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f)) @@ -3445,7 +3445,7 @@ insert into t3 values (0x3f, 'Doffen', 2 explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 22 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1; Using where with pushed condition: (`test`.`y`.`b3` = 'Dole') Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = 'Dole') and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f)) @@ -3461,7 +3461,7 @@ insert into t3 values (0x3f, 'Doffen', 2 explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 518 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1; Using where with pushed condition: (`test`.`y`.`b3` = 'Dole') Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = 'Dole') and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f)) @@ -3477,7 +3477,7 @@ insert into t3 values (0x3f, 'Doffen', 2 explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 20 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1; Using where Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = 'Dole') and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f)) @@ -3492,7 +3492,7 @@ insert into t3 values (0x3f, 'Doffen', 2 explain extended select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ref PRIMARY PRIMARY 4 const 2 100.00 Parent of 2 pushed join@1 +1 SIMPLE x ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 22 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1; Using where Warnings: Note 1003 select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = 'Dole') and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f)) @@ -3508,7 +3508,7 @@ insert into t3 values (0x3f, 0x1f, 3, 0x explain extended select * from t3 x, t3 y where y.a3=x.b3 and y.b3="63"; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ALL NULL NULL NULL NULL 3 66.67 +1 SIMPLE x ALL NULL NULL NULL NULL 3 100.00 1 SIMPLE y eq_ref PRIMARY PRIMARY 5 test.x.b3,const 1 100.00 Using where Warnings: Note 1644 Can't push table 'y' as child, column 'a3' does not have same datatype as ref'ed column 'x.b3' @@ -3552,7 +3552,7 @@ straight_join t1 as t2 on t2.k = t1.b+0 straight_join t1 as t3 on t3.k = t2.b straight_join t1 as t4 on t4.k = t1.b; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 50.00 Parent of 2 pushed join@1 +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Parent of 2 pushed join@1 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 func 1 100.00 Parent of 2 pushed join@2; Using where 1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.b 1 100.00 Child of 't2' in pushed join@2 1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Child of 't1' in pushed join@1 @@ -3703,7 +3703,7 @@ insert into t2 values (11, 12); insert into t2 values (12, 13); explain extended select * from t1, t2 where t1.c = t2.a; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 66.67 Parent of 2 pushed join@1 +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Parent of 2 pushed join@1 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.c 1 100.00 Child of 't1' in pushed join@1 Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`a` = `test`.`t1`.`c`) @@ -3722,7 +3722,7 @@ a b c a b 11 12 12 12 13 explain extended select * from t2, t1 where t2.b = t1.a; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 66.67 Parent of 2 pushed join@1 +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Parent of 2 pushed join@1 1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.b 1 100.00 Child of 't2' in pushed join@1 Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t2` join `test`.`t1` where (`test`.`t1`.`a` = `test`.`t2`.`b`) @@ -3830,7 +3830,7 @@ insert into t1 values (2, 3, 4); insert into t1 values (3, 4, 5); explain extended select * from t1 x, t1 y where x.b=y.a and x.c=4; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ALL NULL NULL NULL NULL 3 66.67 Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x`.`c` = 4) +1 SIMPLE x ALL NULL NULL NULL NULL 3 100.00 Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x`.`c` = 4) 1 SIMPLE y eq_ref PRIMARY PRIMARY 4 test.x.b 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select `test`.`x`.`a` AS `a`,`test`.`x`.`b` AS `b`,`test`.`x`.`c` AS `c`,`test`.`y`.`a` AS `a`,`test`.`y`.`b` AS `b`,`test`.`y`.`c` AS `c` from `test`.`t1` `x` join `test`.`t1` `y` where ((`test`.`x`.`c` = 4) and (`test`.`y`.`a` = `test`.`x`.`b`)) @@ -4087,7 +4087,7 @@ insert into t1 values (1,2,20,30); insert into t1 values (2,3,30,40); explain extended select * from t1 as x join t1 as y join t1 as z on x.u=y.pk and y.a=z.b; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ALL NULL NULL NULL NULL 3 66.67 Parent of 3 pushed join@1 +1 SIMPLE x ALL NULL NULL NULL NULL 3 100.00 Parent of 3 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 4 test.x.u 1 100.00 Child of 'x' in pushed join@1 1 SIMPLE z ref ix1 ix1 5 test.y.a 1 100.00 Child of 'y' in pushed join@1; Using where Warnings: @@ -4118,7 +4118,7 @@ insert into t1 values (0,-1), (1,-1), (2 (132,-1), (133,-1), (134,-1), (135,-1), (136,-1), (137,-1), (138,-1), (139,-1); explain extended select * from t1 as x join t1 as y on x.u=y.pk order by(x.pk); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x index NULL PRIMARY 4 NULL 140 1.43 Parent of 2 pushed join@1 +1 SIMPLE x index NULL PRIMARY 4 NULL 140 100.00 Parent of 2 pushed join@1 1 SIMPLE y eq_ref PRIMARY PRIMARY 4 test.x.u 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select `test`.`x`.`pk` AS `pk`,`test`.`x`.`u` AS `u`,`test`.`y`.`pk` AS `pk`,`test`.`y`.`u` AS `u` from `test`.`t1` `x` join `test`.`t1` `y` where (`test`.`y`.`pk` = `test`.`x`.`u`) order by `test`.`x`.`pk` @@ -4143,7 +4143,7 @@ insert into t1 values (11,11,10,10); explain extended select count(*) from t1 as x1 join t1 as x2 join t1 as x3 on x1.a=x2.u and x2.a = x3.b; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x1 ALL NULL NULL NULL NULL 12 16.67 Parent of 3 pushed join@1 +1 SIMPLE x1 ALL NULL NULL NULL NULL 12 100.00 Parent of 3 pushed join@1 1 SIMPLE x2 eq_ref ix2 ix2 4 test.x1.a 1 100.00 Child of 'x1' in pushed join@1 1 SIMPLE x3 ref ix1 ix1 5 test.x2.a 2 100.00 Child of 'x2' in pushed join@1; Using where Warnings: @@ -4167,7 +4167,7 @@ count(*) insert into t1 values (12,12,20,10); explain extended select count(*) from t1 as x1 left join t1 as x2 on x1.a=x2.b; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x1 ALL NULL NULL NULL NULL 13 92.31 +1 SIMPLE x1 ALL NULL NULL NULL NULL 13 100.00 1 SIMPLE x2 ref ix1 ix1 5 test.x1.a 2 100.00 Warnings: Note 1644 Can't push table 'x2' as child of 'x1', outer join of scan-child not implemented @@ -4596,7 +4596,7 @@ set ndb_join_pushdown=on; explain extended select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x ALL NULL NULL NULL NULL 8 25.00 Parent of 2 pushed join@1 +1 SIMPLE x ALL NULL NULL NULL NULL 8 100.00 Parent of 2 pushed join@1 1 SIMPLE y ref PRIMARY PRIMARY 8 test.x.d,test.x.e 1 100.00 Child of 'x' in pushed join@1 Warnings: Note 1003 select straight_join `test`.`x`.`d` AS `d`,`test`.`x`.`e` AS `e`,`test`.`x`.`f` AS `f`,`test`.`x`.`a` AS `a`,`test`.`x`.`b` AS `b`,`test`.`x`.`c` AS `c`,`test`.`y`.`d` AS `d`,`test`.`y`.`e` AS `e`,`test`.`y`.`f` AS `f`,`test`.`y`.`a` AS `a`,`test`.`y`.`b` AS `b`,`test`.`y`.`c` AS `c` from `test`.`t1` `x` join `test`.`t1` `y` where ((`test`.`y`.`b` = `test`.`x`.`e`) and (`test`.`y`.`a` = `test`.`x`.`d`)) @@ -4808,7 +4808,7 @@ join t1 as x2 on x1.a=x2.b join t1 as x3 on x2.a=x3.b order by x1.pk limit 70; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x1 index NULL PRIMARY 4 NULL 10 20.00 Parent of 3 pushed join@1; Using temporary; Using filesort +1 SIMPLE x1 index NULL PRIMARY 4 NULL 10 100.00 Parent of 3 pushed join@1; Using temporary; Using filesort 1 SIMPLE x2 ref ix1 ix1 5 test.x1.a 2 100.00 Child of 'x1' in pushed join@1; Using where 1 SIMPLE x3 ref ix1 ix1 5 test.x2.a 2 100.00 Child of 'x2' in pushed join@1; Using where Warnings: @@ -4911,7 +4911,7 @@ on table2.pk = table3.pk ) on table1.a = table4.pk where table2.pk != 6; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE table1 ALL NULL NULL NULL NULL 6 33.33 Using temporary +1 SIMPLE table1 ALL NULL NULL NULL NULL 6 100.00 Using temporary 1 SIMPLE table2 range PRIMARY PRIMARY 4 NULL 6 100.00 Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`table2`.`pk` <> 6); Distinct; Using join buffer 1 SIMPLE table3 eq_ref PRIMARY PRIMARY 4 test.table2.pk 1 100.00 Child of 'table2' in pushed join@1; Distinct 1 SIMPLE table4 eq_ref PRIMARY PRIMARY 4 test.table1.a 1 100.00 Using where; Distinct @@ -4953,7 +4953,7 @@ on t1.pk2 = t2.pk1 where t1.pk1 != 6 order by t1.pk1 DESC; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 50.00 Using where with pushed condition: (`test`.`t1`.`pk1` <> 6) +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 6 66.67 Using where with pushed condition: (`test`.`t1`.`pk1` <> 6) 1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.pk2 1 100.00 Warnings: Note 1644 Push of table 't2' as scan-child with ordered indexscan-root 't1' not implemented @@ -4973,7 +4973,7 @@ explain extended select straight_join * from t as a join t as b on a.uq=b.uq or b.uq is null; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE a ALL ix1 NULL NULL NULL 4 50.00 +1 SIMPLE a ALL ix1 NULL NULL NULL 4 100.00 1 SIMPLE b ref_or_null ix1 ix1 5 test.a.uq 2 100.00 Using where Warnings: Note 1644 Table 'b' is not pushable: This table access method can not be pushed. @@ -4996,7 +4996,7 @@ select * from t as a left join t as b on a.k is null and a.uq=b.uq; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE b system NULL NULL NULL NULL 1 100.00 -1 SIMPLE a ALL NULL NULL NULL NULL 4 50.00 +1 SIMPLE a ALL NULL NULL NULL NULL 4 100.00 Warnings: 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))) === added file 'mysql-test/suite/ndb/r/ndb_row_count.result' --- a/mysql-test/suite/ndb/r/ndb_row_count.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/ndb/r/ndb_row_count.result 2011-06-23 12:19:32 +0000 @@ -0,0 +1,115 @@ +create table t1( +a int primary key +) engine=ndbcluster; +insert into t1 values +(00),(01),(02),(03),(04),(05),(06),(07),(08),(09), +(10),(11),(12),(13),(14),(15),(16),(17),(18),(19), +(20),(21),(22),(23),(24),(25),(26),(27),(28),(29), +(30),(31),(32),(33),(34),(35),(36),(37),(38),(39), +(40),(41),(42),(43),(44),(45),(46),(47),(48),(49), +(50),(51),(52),(53),(54),(55),(56),(57),(58),(59), +(60),(61),(62),(63),(64),(65),(66),(67),(68),(69), +(70),(71),(72),(73),(74),(75),(76),(77),(78),(79), +(80),(81),(82),(83),(84),(85),(86),(87),(88),(89), +(90),(91),(92),(93),(94),(95),(96),(97),(98),(99); + +# expected result 0 roundtrips - read stats from share +explain extended select * from t1 where a < 100; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 10 100.00 Using where with pushed condition: (`test`.`t1`.`a` < 100) +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` < 100) +@ndb_execute_count:=VARIABLE_VALUE-@ndb_init_execute_count +0 +insert into t1 select a+100 from t1; + +# expected result 0 roundtrips - read stats from share +explain extended select * from t1 where a < 100; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 20 100.00 Using where with pushed condition: (`test`.`t1`.`a` < 100) +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` < 100) +@ndb_execute_count:=VARIABLE_VALUE-@ndb_init_execute_count +0 +delete from t1 where a >= 100; + +# expected result 0 roundtrips - read stats from share +explain extended select * from t1 where a < 100; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 10 100.00 Using where with pushed condition: (`test`.`t1`.`a` < 100) +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` < 100) +@ndb_execute_count:=VARIABLE_VALUE-@ndb_init_execute_count +0 +begin; +insert into t1 select a+100 from t1; +commit; + +# expected result 0 roundtrips - read stats from share +explain extended select * from t1 where a < 100; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 20 100.00 Using where with pushed condition: (`test`.`t1`.`a` < 100) +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` < 100) +@ndb_execute_count:=VARIABLE_VALUE-@ndb_init_execute_count +0 +begin; +delete from t1 where a >= 100; +commit; + +# expected result 0 roundtrips - read stats from share +explain extended select * from t1 where a < 100; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 10 100.00 Using where with pushed condition: (`test`.`t1`.`a` < 100) +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` < 100) +@ndb_execute_count:=VARIABLE_VALUE-@ndb_init_execute_count +0 +begin; +insert into t1 select a+100 from t1; +rollback; + +# expected result 0 roundtrips - read stats from share +explain extended select * from t1 where a < 100; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 10 100.00 Using where with pushed condition: (`test`.`t1`.`a` < 100) +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` < 100) +@ndb_execute_count:=VARIABLE_VALUE-@ndb_init_execute_count +0 +begin; +delete from t1 where a <= 100; +rollback; + +# expected result 0 roundtrips - read stats from share +explain extended select * from t1 where a < 100; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 10 100.00 Using where with pushed condition: (`test`.`t1`.`a` < 100) +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` < 100) +@ndb_execute_count:=VARIABLE_VALUE-@ndb_init_execute_count +0 +insert into t1 select a from t1; +ERROR 23000: Can't write; duplicate key in table 't1' + +# expected result 0 roundtrips - read stats from share +explain extended select * from t1 where a < 100; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 10 100.00 Using where with pushed condition: (`test`.`t1`.`a` < 100) +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` < 100) +@ndb_execute_count:=VARIABLE_VALUE-@ndb_init_execute_count +0 +begin; +insert into t1 select a from t1; +ERROR 23000: Can't write; duplicate key in table 't1' + +# expected result 0 roundtrips - read stats from share +explain extended select * from t1 where a < 100; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 10 100.00 Using where with pushed condition: (`test`.`t1`.`a` < 100) +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` < 100) +@ndb_execute_count:=VARIABLE_VALUE-@ndb_init_execute_count +0 +drop table t1; === added file 'mysql-test/suite/ndb/t/ndb_row_count.test' --- a/mysql-test/suite/ndb/t/ndb_row_count.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/ndb/t/ndb_row_count.test 2011-06-23 12:19:32 +0000 @@ -0,0 +1,100 @@ +-- source include/have_ndb.inc + +create table t1( + a int primary key +) engine=ndbcluster; + +insert into t1 values +(00),(01),(02),(03),(04),(05),(06),(07),(08),(09), +(10),(11),(12),(13),(14),(15),(16),(17),(18),(19), +(20),(21),(22),(23),(24),(25),(26),(27),(28),(29), +(30),(31),(32),(33),(34),(35),(36),(37),(38),(39), +(40),(41),(42),(43),(44),(45),(46),(47),(48),(49), +(50),(51),(52),(53),(54),(55),(56),(57),(58),(59), +(60),(61),(62),(63),(64),(65),(66),(67),(68),(69), +(70),(71),(72),(73),(74),(75),(76),(77),(78),(79), +(80),(81),(82),(83),(84),(85),(86),(87),(88),(89), +(90),(91),(92),(93),(94),(95),(96),(97),(98),(99); + +--echo +--echo # expected result 0 roundtrips - read stats from share +--source suite/ndb/include/ndb_init_execute_count.inc +explain extended select * from t1 where a < 100; +--source suite/ndb/include/ndb_execute_count.inc + +insert into t1 select a+100 from t1; + +--echo +--echo # expected result 0 roundtrips - read stats from share +--source suite/ndb/include/ndb_init_execute_count.inc +explain extended select * from t1 where a < 100; +--source suite/ndb/include/ndb_execute_count.inc + +delete from t1 where a >= 100; + +--echo +--echo # expected result 0 roundtrips - read stats from share +--source suite/ndb/include/ndb_init_execute_count.inc +explain extended select * from t1 where a < 100; +--source suite/ndb/include/ndb_execute_count.inc + +begin; +insert into t1 select a+100 from t1; +commit; + +--echo +--echo # expected result 0 roundtrips - read stats from share +--source suite/ndb/include/ndb_init_execute_count.inc +explain extended select * from t1 where a < 100; +--source suite/ndb/include/ndb_execute_count.inc + +begin; +delete from t1 where a >= 100; +commit; + +--echo +--echo # expected result 0 roundtrips - read stats from share +--source suite/ndb/include/ndb_init_execute_count.inc +explain extended select * from t1 where a < 100; +--source suite/ndb/include/ndb_execute_count.inc + +begin; +insert into t1 select a+100 from t1; +rollback; + +--echo +--echo # expected result 0 roundtrips - read stats from share +--source suite/ndb/include/ndb_init_execute_count.inc +explain extended select * from t1 where a < 100; +--source suite/ndb/include/ndb_execute_count.inc + +begin; +delete from t1 where a <= 100; +rollback; + +--echo +--echo # expected result 0 roundtrips - read stats from share +--source suite/ndb/include/ndb_init_execute_count.inc +explain extended select * from t1 where a < 100; +--source suite/ndb/include/ndb_execute_count.inc + +--error ER_DUP_KEY +insert into t1 select a from t1; + +--echo +--echo # expected result 0 roundtrips - read stats from share +--source suite/ndb/include/ndb_init_execute_count.inc +explain extended select * from t1 where a < 100; +--source suite/ndb/include/ndb_execute_count.inc + +begin; +--error ER_DUP_KEY +insert into t1 select a from t1; + +--echo +--echo # expected result 0 roundtrips - read stats from share +--source suite/ndb/include/ndb_init_execute_count.inc +explain extended select * from t1 where a < 100; +--source suite/ndb/include/ndb_execute_count.inc + +drop table t1; === modified file 'sql/ha_ndbcluster.cc' --- a/sql/ha_ndbcluster.cc 2011-06-22 12:21:58 +0000 +++ b/sql/ha_ndbcluster.cc 2011-06-24 12:32:05 +0000 @@ -284,9 +284,7 @@ static MYSQL_THDVAR_BOOL( */ bool ndb_index_stat_get_enable(THD *thd) { - mysql_mutex_lock(&LOCK_global_system_variables); const bool value = THDVAR(thd, index_stat_enable); - mysql_mutex_unlock(&LOCK_global_system_variables); return value; } @@ -427,6 +425,9 @@ HASH ndbcluster_open_tables; static uchar *ndbcluster_get_key(NDB_SHARE *share, size_t *length, my_bool not_used __attribute__((unused))); +static void modify_shared_stats(NDB_SHARE *share, + Ndb_local_table_statistics *local_stat); + static int ndb_get_table_statistics(THD *thd, ha_ndbcluster*, bool, Ndb*, const NdbRecord *, struct Ndb_statistics *, bool have_lock= FALSE, @@ -6571,27 +6572,50 @@ int ha_ndbcluster::info(uint flag) if (!thd) thd= current_thd; DBUG_PRINT("info", ("HA_STATUS_VARIABLE")); - if ((flag & HA_STATUS_NO_LOCK) && - !THDVAR(thd, use_exact_count)) - { - if (thd->lex->sql_command != SQLCOM_SHOW_TABLE_STATUS && - thd->lex->sql_command != SQLCOM_SHOW_KEYS) - { - /* - just use whatever stats we have however, - optimizer behaves strangely if we return few rows - */ - if (stats.records < 2) - stats.records= 2; - break; - } - } + if (!m_table_info) { if ((my_errno= check_ndb_connection(thd))) DBUG_RETURN(my_errno); } - result= update_stats(thd, 1); + + /* + May need to update local copy of statistics in + 'm_table_info', either directly from datanodes, + or from shared (mutex protected) cached copy, if: + 1) 'use_exact_count' has been set (by config or user). + 2) HA_STATUS_NO_LOCK -> read from shared cached copy. + 3) Local copy is invalid. + */ + bool exact_count= THDVAR(thd, use_exact_count); + if (exact_count || // 1) + !(flag & HA_STATUS_NO_LOCK) || // 2) + m_table_info == NULL || // 3) + m_table_info->records == ~(ha_rows)0) // 3) + { + result= update_stats(thd, (exact_count || !(flag & HA_STATUS_NO_LOCK))); + if (result) + DBUG_RETURN(result); + } + /* Read from local statistics, fast and fuzzy, wo/ locks */ + else + { + DBUG_ASSERT(m_table_info->records != ~(ha_rows)0); + stats.records= m_table_info->records + + m_table_info->no_uncommitted_rows_count; + } + + if (thd->lex->sql_command != SQLCOM_SHOW_TABLE_STATUS && + thd->lex->sql_command != SQLCOM_SHOW_KEYS) + { + /* + just use whatever stats we have. However, + optimizer interprets the values 0 and 1 as EXACT: + -> < 2 should not be returned. + */ + if (stats.records < 2) + stats.records= 2; + } break; } /* RPK moved to variable part */ @@ -7170,7 +7194,18 @@ int ha_ndbcluster::start_statement(THD * there is more than one handler involved, execute deferal not possible */ + ha_ndbcluster* handler = thd_ndb->m_handler; thd_ndb->m_handler= NULL; + if (handler != NULL) + { + /** + * If we initially belived that this could be run + * using execute deferal...but changed out mind + * add handler to thd_ndb->open_tables like it would + * have done "normally" + */ + add_handler_to_open_tables(thd, thd_ndb, handler); + } } if (!trans && table_count == 0) { @@ -7216,6 +7251,57 @@ int ha_ndbcluster::start_statement(THD * DBUG_RETURN(0); } +int +ha_ndbcluster::add_handler_to_open_tables(THD *thd, + Thd_ndb *thd_ndb, + ha_ndbcluster* handler) +{ + DBUG_ENTER("ha_ndbcluster::add_handler_to_open_tables"); + DBUG_PRINT("info", ("Adding %s", handler->m_share->key)); + + /** + * thd_ndb->open_tables is only used iff thd_ndb->m_handler is not + */ + DBUG_ASSERT(thd_ndb->m_handler == NULL); + const void *key= handler->m_share; + HASH_SEARCH_STATE state; + THD_NDB_SHARE *thd_ndb_share= + (THD_NDB_SHARE*)my_hash_first(&thd_ndb->open_tables, + (const uchar *)&key, sizeof(key), + &state); + while (thd_ndb_share && thd_ndb_share->key != key) + { + thd_ndb_share= + (THD_NDB_SHARE*)my_hash_next(&thd_ndb->open_tables, + (const uchar *)&key, sizeof(key), + &state); + } + if (thd_ndb_share == 0) + { + thd_ndb_share= (THD_NDB_SHARE *) alloc_root(&thd->transaction.mem_root, + sizeof(THD_NDB_SHARE)); + if (!thd_ndb_share) + { + mem_alloc_error(sizeof(THD_NDB_SHARE)); + DBUG_RETURN(1); + } + thd_ndb_share->key= key; + thd_ndb_share->stat.last_count= thd_ndb->count; + thd_ndb_share->stat.no_uncommitted_rows_count= 0; + thd_ndb_share->stat.records= ~(ha_rows)0; + my_hash_insert(&thd_ndb->open_tables, (uchar *)thd_ndb_share); + } + else if (thd_ndb_share->stat.last_count != thd_ndb->count) + { + thd_ndb_share->stat.last_count= thd_ndb->count; + thd_ndb_share->stat.no_uncommitted_rows_count= 0; + thd_ndb_share->stat.records= ~(ha_rows)0; + } + + handler->m_table_info= &thd_ndb_share->stat; + DBUG_RETURN(0); +} + int ha_ndbcluster::init_handler_for_statement(THD *thd) { /* @@ -7249,45 +7335,11 @@ int ha_ndbcluster::init_handler_for_stat } #endif - if (thd_options(thd) & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) + int ret = 0; + if (thd_ndb->m_handler == 0) { - const void *key= m_table; - HASH_SEARCH_STATE state; - THD_NDB_SHARE *thd_ndb_share= - (THD_NDB_SHARE*)my_hash_first(&thd_ndb->open_tables, - (const uchar *)&key, sizeof(key), - &state); - while (thd_ndb_share && thd_ndb_share->key != key) - { - thd_ndb_share= - (THD_NDB_SHARE*)my_hash_next(&thd_ndb->open_tables, - (const uchar *)&key, sizeof(key), - &state); - } - if (thd_ndb_share == 0) - { - thd_ndb_share= (THD_NDB_SHARE *) alloc_root(&thd->transaction.mem_root, - sizeof(THD_NDB_SHARE)); - if (!thd_ndb_share) - { - mem_alloc_error(sizeof(THD_NDB_SHARE)); - DBUG_RETURN(1); - } - thd_ndb_share->key= key; - thd_ndb_share->stat.last_count= thd_ndb->count; - thd_ndb_share->stat.no_uncommitted_rows_count= 0; - thd_ndb_share->stat.records= ~(ha_rows)0; - my_hash_insert(&thd_ndb->open_tables, (uchar *)thd_ndb_share); - } - else if (thd_ndb_share->stat.last_count != thd_ndb->count) - { - thd_ndb_share->stat.last_count= thd_ndb->count; - thd_ndb_share->stat.no_uncommitted_rows_count= 0; - thd_ndb_share->stat.records= ~(ha_rows)0; - } - DBUG_PRINT("exit", ("thd_ndb_share: 0x%lx key: 0x%lx", - (long) thd_ndb_share, (long) key)); - m_table_info= &thd_ndb_share->stat; + DBUG_ASSERT(m_share); + ret = add_handler_to_open_tables(thd, thd_ndb, this); } else { @@ -7297,7 +7349,7 @@ int ha_ndbcluster::init_handler_for_stat stat.records= ~(ha_rows)0; m_table_info= &stat; } - DBUG_RETURN(0); + DBUG_RETURN(ret); } int ha_ndbcluster::external_lock(THD *thd, int lock_type) @@ -7673,6 +7725,25 @@ int ndbcluster_commit(handlerton *hton, if (res != -1) ndbcluster_print_error(res, error_op); } + else + { + /* Update shared statistics for tables inserted into / deleted from*/ + if (thd_ndb->m_handler && // Autocommit Txn + thd_ndb->m_handler->m_share && + thd_ndb->m_handler->m_table_info) + { + modify_shared_stats(thd_ndb->m_handler->m_share, thd_ndb->m_handler->m_table_info); + } + + /* Manual commit: Update all affected NDB_SHAREs found in 'open_tables' */ + for (uint i= 0; iopen_tables.records; i++) + { + THD_NDB_SHARE *thd_share= + (THD_NDB_SHARE*)my_hash_element(&thd_ndb->open_tables, i); + modify_shared_stats((NDB_SHARE*)thd_share->key, &thd_share->stat); + } + } + ndb->closeTransaction(trans); thd_ndb->trans= NULL; thd_ndb->m_handler= NULL; @@ -12859,8 +12930,22 @@ int ha_ndbcluster::update_stats(THD *thd struct Ndb_statistics stat; Thd_ndb *thd_ndb= get_thd_ndb(thd); DBUG_ENTER("ha_ndbcluster::update_stats"); - if (do_read_stat || !m_share) + do { + if (m_share && !do_read_stat) + { + pthread_mutex_lock(&m_share->mutex); + stat= m_share->stat; + pthread_mutex_unlock(&m_share->mutex); + + DBUG_ASSERT(stat.row_count != ~(ha_rows)0); // should never be invalid + + /* Accept shared cached statistics if row_count is valid. */ + if (stat.row_count != ~(ha_rows)0) + break; + } + + /* Request statistics from datanodes */ Ndb *ndb= thd_ndb->ndb; if (ndb->setDatabaseName(m_dbname)) { @@ -12872,25 +12957,25 @@ int ha_ndbcluster::update_stats(THD *thd { DBUG_RETURN(err); } + + /* Update shared statistics with fresh data */ if (m_share) { pthread_mutex_lock(&m_share->mutex); m_share->stat= stat; pthread_mutex_unlock(&m_share->mutex); } + break; } - else + while(0); + + int no_uncommitted_rows_count= 0; + if (m_table_info && !thd_ndb->m_error) { - pthread_mutex_lock(&m_share->mutex); - stat= m_share->stat; - pthread_mutex_unlock(&m_share->mutex); + m_table_info->records= stat.row_count; + m_table_info->last_count= thd_ndb->count; + no_uncommitted_rows_count= m_table_info->no_uncommitted_rows_count; } - struct Ndb_local_table_statistics *local_info= m_table_info; - int no_uncommitted_rows_count; - if (thd_ndb->m_error || !local_info) - no_uncommitted_rows_count= 0; - else - no_uncommitted_rows_count= local_info->no_uncommitted_rows_count; stats.mean_rec_length= stat.row_size; stats.data_file_length= stat.fragment_memory; stats.records= stat.row_count + no_uncommitted_rows_count; @@ -12910,6 +12995,35 @@ int ha_ndbcluster::update_stats(THD *thd DBUG_RETURN(0); } +/** + Update 'row_count' in shared table statistcs if any rows where + inserted/deleted by the local transaction related to specified + 'local_stat'. + Should be called when transaction has succesfully commited its changes. +*/ +static +void modify_shared_stats(NDB_SHARE *share, + Ndb_local_table_statistics *local_stat) +{ + if (local_stat->no_uncommitted_rows_count) + { + pthread_mutex_lock(&share->mutex); + DBUG_ASSERT(share->stat.row_count != ~(ha_rows)0);// should never be invalid + if (share->stat.row_count != ~(ha_rows)0) + { + DBUG_PRINT("info", ("Update row_count for %s, row_count: %lu, with:%d", + share->table_name, (ulong) share->stat.row_count, + local_stat->no_uncommitted_rows_count)); + share->stat.row_count= + ((Int64)share->stat.row_count+local_stat->no_uncommitted_rows_count > 0) + ? share->stat.row_count+local_stat->no_uncommitted_rows_count + : 0; + } + pthread_mutex_unlock(&share->mutex); + local_stat->no_uncommitted_rows_count= 0; + } +} + /* If part_id contains a legal partition id, ndbstat returns the partition-statistics pertaining to that partition only. Otherwise, it returns the table-statistics, === modified file 'sql/ha_ndbcluster.h' --- a/sql/ha_ndbcluster.h 2011-06-22 12:21:58 +0000 +++ b/sql/ha_ndbcluster.h 2011-06-24 12:32:05 +0000 @@ -1066,6 +1066,7 @@ private: int update_stats(THD *thd, bool do_read_stat, bool have_lock= FALSE, uint part_id= ~(uint)0); + int add_handler_to_open_tables(THD*, Thd_ndb*, ha_ndbcluster* handler); }; int ndbcluster_discover(THD* thd, const char* dbname, const char* name, === modified file 'storage/ndb/src/kernel/blocks/dbspj/Dbspj.hpp' --- a/storage/ndb/src/kernel/blocks/dbspj/Dbspj.hpp 2011-06-24 12:06:45 +0000 +++ b/storage/ndb/src/kernel/blocks/dbspj/Dbspj.hpp 2011-06-24 12:32:05 +0000 @@ -532,7 +532,7 @@ public: struct ScanIndexData { - Uint16 m_frags_not_complete; + Uint16 m_frags_complete; Uint16 m_frags_outstanding; Uint32 m_rows_received; // #execTRANSID_AI Uint32 m_rows_expecting; // Sum(ScanFragConf) === modified file 'storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp' --- a/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp 2011-06-24 12:06:45 +0000 +++ b/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp 2011-06-24 12:32:05 +0000 @@ -4449,7 +4449,7 @@ Dbspj::parseScanIndex(Build_context& ctx ScanIndexData& data = treeNodePtr.p->m_scanindex_data; data.m_fragments.init(); data.m_frags_outstanding = 0; - data.m_frags_not_complete = 0; + data.m_frags_complete = 0; data.m_batch_chunks = 0; err = parseDA(ctx, requestPtr, treeNodePtr, @@ -4679,6 +4679,7 @@ Dbspj::execDIH_SCAN_TAB_CONF(Signal* sig } } } + data.m_frags_complete = data.m_fragCount; if (!pruned) { @@ -4966,7 +4967,8 @@ Dbspj::scanIndex_parent_batch_complete(S data.m_rows_received = 0; data.m_rows_expecting = 0; ndbassert(data.m_frags_outstanding == 0); - ndbassert(data.m_frags_not_complete == 0); + ndbassert(data.m_frags_complete == data.m_fragCount); + data.m_frags_complete = 0; Ptr fragPtr; { @@ -4975,32 +4977,33 @@ Dbspj::scanIndex_parent_batch_complete(S if ((treeNodePtr.p->m_bits & TreeNode::T_PRUNE_PATTERN) == 0) { - if (fragPtr.p->m_rangePtrI != RNIL) + if (fragPtr.p->m_rangePtrI == RNIL) { - // No pruning, so we must scan all fragments. + // No keys found jam(); - data.m_frags_not_complete = data.m_fragCount; + data.m_frags_complete = data.m_fragCount; } } else { while(!fragPtr.isNull()) { - if (fragPtr.p->m_rangePtrI != RNIL) + if (fragPtr.p->m_rangePtrI == RNIL) { jam(); /** * This is a pruned scan, so we must scan those fragments that * some distribution key hashed to. */ - data.m_frags_not_complete++; + fragPtr.p->m_state = ScanFragHandle::SFH_COMPLETE; + data.m_frags_complete++; } list.next(fragPtr); } } } - if (data.m_frags_not_complete == 0) + if (data.m_frags_complete == data.m_fragCount) { jam(); /** @@ -5058,7 +5061,7 @@ Dbspj::scanIndex_send(Signal* signal, if (treeNodePtr.p->m_bits & TreeNode::T_SCAN_PARALLEL) { jam(); - cnt = data.m_frags_not_complete; + cnt = data.m_fragCount - data.m_frags_complete; ndbrequire(cnt > 0); bs_rows /= cnt; @@ -5194,7 +5197,8 @@ Dbspj::scanIndex_send(Signal* signal, if (treeNodePtr.p->m_bits & TreeNode::T_SCAN_PARALLEL) { - ndbrequire(data.m_frags_outstanding == data.m_frags_not_complete); + ndbrequire(data.m_frags_outstanding == + data.m_fragCount - data.m_frags_complete); } else { @@ -5295,10 +5299,10 @@ Dbspj::scanIndex_execSCAN_FRAGCONF(Signa { jam(); fragPtr.p->m_state = ScanFragHandle::SFH_COMPLETE; - ndbrequire(data.m_frags_not_complete>0); - data.m_frags_not_complete--; + ndbrequire(data.m_frags_complete < data.m_fragCount); + data.m_frags_complete++; - if (data.m_frags_not_complete == 0) + if (data.m_frags_complete == data.m_fragCount) { jam(); ndbrequire(requestPtr.p->m_cnt_active); @@ -5355,12 +5359,12 @@ Dbspj::scanIndex_execSCAN_FRAGREF(Signal fragPtr.p->m_state = ScanFragHandle::SFH_COMPLETE; ScanIndexData& data = treeNodePtr.p->m_scanindex_data; - ndbrequire(data.m_frags_not_complete > 0); - data.m_frags_not_complete--; + ndbrequire(data.m_frags_complete < data.m_fragCount); + data.m_frags_complete++; ndbrequire(data.m_frags_outstanding > 0); data.m_frags_outstanding--; - if (data.m_frags_not_complete == 0) + if (data.m_frags_complete == data.m_fragCount) { jam(); ndbrequire(requestPtr.p->m_cnt_active); @@ -5391,8 +5395,8 @@ Dbspj::scanIndex_execSCAN_NEXTREQ(Signal data.m_rows_expecting = 0; ndbassert(data.m_frags_outstanding == 0); - ndbrequire(data.m_frags_not_complete>0); - Uint32 cnt = data.m_frags_not_complete; + ndbrequire(data.m_frags_complete < data.m_fragCount); + Uint32 cnt = data.m_fragCount - data.m_frags_complete; if ((treeNodePtr.p->m_bits & TreeNode::T_SCAN_PARALLEL) == 0) { jam(); @@ -5581,7 +5585,7 @@ Dbspj::scanIndex_execNODE_FAILREP(Signal Ptr fragPtr; Uint32 save0 = data.m_frags_outstanding; - Uint32 save1 = data.m_frags_not_complete; + Uint32 save1 = data.m_frags_complete; for (list.first(fragPtr); !fragPtr.isNull(); list.next(fragPtr)) { @@ -5597,8 +5601,8 @@ Dbspj::scanIndex_execNODE_FAILREP(Signal switch(fragPtr.p->m_state){ case ScanFragHandle::SFH_NOT_STARTED: jam(); - ndbrequire(data.m_frags_not_complete > 0); - data.m_frags_not_complete--; + ndbrequire(data.m_frags_complete < data.m_fragCount); + data.m_frags_complete++; // fall through case ScanFragHandle::SFH_COMPLETE: jam(); @@ -5618,8 +5622,8 @@ Dbspj::scanIndex_execNODE_FAILREP(Signal case ScanFragHandle::SFH_WAIT_NEXTREQ: jam(); sum++; - ndbrequire(data.m_frags_not_complete > 0); - data.m_frags_not_complete--; + ndbrequire(data.m_frags_complete < data.m_fragCount); + data.m_frags_complete++; break; } fragPtr.p->m_ref = 0; @@ -5633,7 +5637,8 @@ Dbspj::scanIndex_execNODE_FAILREP(Signal requestPtr.p->m_outstanding--; } - if (save1 != 0 && data.m_frags_not_complete == 0) + if (save1 != data.m_fragCount + && data.m_frags_complete == data.m_fragCount) { jam(); ndbrequire(requestPtr.p->m_cnt_active); No bundle (reason: revision is a merge).