From: Ole John Aske Date: August 27 2010 8:41pm Subject: bzr commit into mysql-5.1-telco-7.0-spj-scan-vs-scan branch (ole.john.aske:3254) List-Archive: http://lists.mysql.com/commits/117056 Message-Id: <20100827204126.AFC1321D@fimafeng09.norway.sun.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1967407527148263655==" --===============1967407527148263655== MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline #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 3254 Ole John Aske 2010-08-27 MTR testcase for pruned indexscan modified: mysql-test/suite/ndb/r/ndb_join_pushdown.result mysql-test/suite/ndb/t/ndb_join_pushdown.test === modified file 'mysql-test/suite/ndb/r/ndb_join_pushdown.result' --- a/mysql-test/suite/ndb/r/ndb_join_pushdown.result 2010-08-26 08:24:31 +0000 +++ b/mysql-test/suite/ndb/r/ndb_join_pushdown.result 2010-08-27 20:41:20 +0000 @@ -3460,4 +3460,104 @@ count(*) 1885 set ndb_join_pushdown=on; drop table t1; +create table t1( +d int not null, +e int not null, +f int not null, +a int not null, +b int not null, +c int not null, +primary key (a,b,c)) +engine = ndb partition by key (b); +insert into t1(a,b,c,d,e,f) values +(1, 2, 3, 1, 2, 3), +(1, 2, 4, 1, 2, 3), +(2, 3, 4, 1, 2, 3), +(3, 4, 5, 1, 2, 3), +(4, 5, 6, 1, 2, 3), +(5, 6, 7, 1, 2, 3), +(6, 7, 8, 1, 2, 3), +(7, 8, 9, 1, 2, 3); +set ndb_join_pushdown=on; +explain +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 Extra +1 SIMPLE x ALL NULL NULL NULL NULL 8 Parent of 2 pushed join@1 +1 SIMPLE y ref PRIMARY PRIMARY 8 test.x.d,test.x.e 1 Child of pushed join@1 +select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e; +d e f a b c d e f a b c +1 2 3 1 2 3 1 2 3 1 2 3 +1 2 3 1 2 3 1 2 3 1 2 4 +1 2 3 1 2 4 1 2 3 1 2 3 +1 2 3 1 2 4 1 2 3 1 2 4 +1 2 3 2 3 4 1 2 3 1 2 3 +1 2 3 2 3 4 1 2 3 1 2 4 +1 2 3 3 4 5 1 2 3 1 2 3 +1 2 3 3 4 5 1 2 3 1 2 4 +1 2 3 4 5 6 1 2 3 1 2 3 +1 2 3 4 5 6 1 2 3 1 2 4 +1 2 3 5 6 7 1 2 3 1 2 3 +1 2 3 5 6 7 1 2 3 1 2 4 +1 2 3 6 7 8 1 2 3 1 2 3 +1 2 3 6 7 8 1 2 3 1 2 4 +1 2 3 7 8 9 1 2 3 1 2 3 +1 2 3 7 8 9 1 2 3 1 2 4 +alter table t1 partition by key (a); +select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e; +d e f a b c d e f a b c +1 2 3 1 2 3 1 2 3 1 2 3 +1 2 3 1 2 3 1 2 3 1 2 4 +1 2 3 1 2 4 1 2 3 1 2 3 +1 2 3 1 2 4 1 2 3 1 2 4 +1 2 3 2 3 4 1 2 3 1 2 3 +1 2 3 2 3 4 1 2 3 1 2 4 +1 2 3 3 4 5 1 2 3 1 2 3 +1 2 3 3 4 5 1 2 3 1 2 4 +1 2 3 4 5 6 1 2 3 1 2 3 +1 2 3 4 5 6 1 2 3 1 2 4 +1 2 3 5 6 7 1 2 3 1 2 3 +1 2 3 5 6 7 1 2 3 1 2 4 +1 2 3 6 7 8 1 2 3 1 2 3 +1 2 3 6 7 8 1 2 3 1 2 4 +1 2 3 7 8 9 1 2 3 1 2 3 +1 2 3 7 8 9 1 2 3 1 2 4 +alter table t1 partition by key (a,b); +select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e; +d e f a b c d e f a b c +1 2 3 1 2 3 1 2 3 1 2 3 +1 2 3 1 2 3 1 2 3 1 2 4 +1 2 3 1 2 4 1 2 3 1 2 3 +1 2 3 1 2 4 1 2 3 1 2 4 +1 2 3 2 3 4 1 2 3 1 2 3 +1 2 3 2 3 4 1 2 3 1 2 4 +1 2 3 3 4 5 1 2 3 1 2 3 +1 2 3 3 4 5 1 2 3 1 2 4 +1 2 3 4 5 6 1 2 3 1 2 3 +1 2 3 4 5 6 1 2 3 1 2 4 +1 2 3 5 6 7 1 2 3 1 2 3 +1 2 3 5 6 7 1 2 3 1 2 4 +1 2 3 6 7 8 1 2 3 1 2 3 +1 2 3 6 7 8 1 2 3 1 2 4 +1 2 3 7 8 9 1 2 3 1 2 3 +1 2 3 7 8 9 1 2 3 1 2 4 +alter table t1 partition by key (b,a); +select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e; +d e f a b c d e f a b c +1 2 3 1 2 3 1 2 3 1 2 3 +1 2 3 1 2 3 1 2 3 1 2 4 +1 2 3 1 2 4 1 2 3 1 2 3 +1 2 3 1 2 4 1 2 3 1 2 4 +1 2 3 2 3 4 1 2 3 1 2 3 +1 2 3 2 3 4 1 2 3 1 2 4 +1 2 3 3 4 5 1 2 3 1 2 3 +1 2 3 3 4 5 1 2 3 1 2 4 +1 2 3 4 5 6 1 2 3 1 2 3 +1 2 3 4 5 6 1 2 3 1 2 4 +1 2 3 5 6 7 1 2 3 1 2 3 +1 2 3 5 6 7 1 2 3 1 2 4 +1 2 3 6 7 8 1 2 3 1 2 3 +1 2 3 6 7 8 1 2 3 1 2 4 +1 2 3 7 8 9 1 2 3 1 2 3 +1 2 3 7 8 9 1 2 3 1 2 4 +drop table t1; set ndb_join_pushdown = @save_ndb_join_pushdown; === modified file 'mysql-test/suite/ndb/t/ndb_join_pushdown.test' --- a/mysql-test/suite/ndb/t/ndb_join_pushdown.test 2010-08-26 08:24:31 +0000 +++ b/mysql-test/suite/ndb/t/ndb_join_pushdown.test 2010-08-27 20:41:20 +0000 @@ -2347,6 +2347,10 @@ where y.pk = 2; drop table t1; +######################################### +# Test section for scan-child operations +######################################### + # Test scan-lookup-scan query (see http://lists.mysql.com/commits/115164) create table t1 (pk int primary key, u int not null, a int, b int) engine=ndb; @@ -2470,5 +2474,50 @@ set ndb_join_pushdown=on; drop table t1; +############################################# +# Test pruned index scan: +create table t1( + d int not null, + e int not null, + f int not null, + a int not null, + b int not null, + c int not null, + primary key (a,b,c)) +engine = ndb partition by key (b); + +insert into t1(a,b,c,d,e,f) values + (1, 2, 3, 1, 2, 3), + (1, 2, 4, 1, 2, 3), + (2, 3, 4, 1, 2, 3), + (3, 4, 5, 1, 2, 3), + (4, 5, 6, 1, 2, 3), + (5, 6, 7, 1, 2, 3), + (6, 7, 8, 1, 2, 3), + (7, 8, 9, 1, 2, 3); + +set ndb_join_pushdown=on; + +explain +select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e; + +--sorted_result +select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e; + +alter table t1 partition by key (a); +--sorted_result +select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e; + +alter table t1 partition by key (a,b); +--sorted_result +select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e; + +alter table t1 partition by key (b,a); +--sorted_result +select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e; + +drop table t1; + + set ndb_join_pushdown = @save_ndb_join_pushdown; --===============1967407527148263655== 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 # target_branch: file:///net/fimafeng09/export/home/tmp/oleja/mysql\ # /mysql-5.1-telco-7.0-spj-scan-scan/ # testament_sha1: d53b442f8ae2d9b4fba02fa026e9813c930f05d1 # timestamp: 2010-08-27 22:41:26 +0200 # source_branch: bzr+ssh://oaske@stripped/bzrroot/server\ # /mysql-5.1-telco-7.0-spj/ # base_revision_id: ole.john.aske@stripped\ # 5pakenkk50membvb # # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0C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