diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2009-12-15 10:16:46 +0300 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2009-12-15 10:16:46 +0300 |
commit | 96e092dc73529978053c1e41aa09b70fd2c7c408 (patch) | |
tree | b6e8286b05a0b2e8772ec6da055337812d60b3e8 | |
parent | e4e1ae0d13da399d53bd91df791b149f3eae796b (diff) | |
download | mariadb-git-96e092dc73529978053c1e41aa09b70fd2c7c408.tar.gz |
Backport into MariaDB-5.2 the following:
WL#2474 "Multi Range Read: Change the default MRR implementation to implement new MRR interface"
WL#2475 "Batched range read functions for MyISAM/InnoDb"
"Index condition pushdown for MyISAM/InnoDB"
Igor's fix from sp1r-igor@olga.mysql.com-20080330055902-07614:
There could be observed the following problems:
1. EXPLAIN did not mention pushdown conditions from on expressions in the
'extra' column. As a result if a query had no where conditions pushed
down to a table, but had on conditions pushed to this table the 'extra'
column in the EXPLAIN for the table missed 'using where'.
2. Conditions for ref access were not eliminated from on expressions
though such conditions were eliminated from the where condition.
136 files changed, 18729 insertions, 1144 deletions
diff --git a/include/my_handler.h b/include/my_handler.h index edb8e21b6a2..300d6f1fed1 100644 --- a/include/my_handler.h +++ b/include/my_handler.h @@ -123,6 +123,26 @@ extern void my_handler_error_unregister(void); this amount of bytes. */ #define portable_sizeof_char_ptr 8 + +/** + Return values of index_cond_func_xxx functions. + + 0=ICP_NO_MATCH - index tuple doesn't satisfy the pushed index condition (the + engine should discard the tuple and go to the next one) + 1=ICP_MATCH - index tuple satisfies the pushed index condition (the engine + should fetch and return the record) + 2=ICP_OUT_OF_RANGE - index tuple is out range that we're scanning, e.g. this + if we're scanning "t.key BETWEEN 10 AND 20" and got a + "t.key=21" tuple (the engine should stop scanning and return + HA_ERR_END_OF_FILE right away). +*/ + +typedef enum icp_result { + ICP_NO_MATCH, + ICP_MATCH, + ICP_OUT_OF_RANGE +} ICP_RESULT; + #ifdef __cplusplus } #endif diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index ecf45a23399..9645daf9ddd 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -45,7 +45,7 @@ libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c \ noinst_HEADERS = embedded_priv.h emb_qcache.h -sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \ +sqlsources = ds_mrr.cc derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \ ha_ndbcluster.cc ha_ndbcluster_cond.cc \ ha_ndbcluster_binlog.cc ha_partition.cc \ handler.cc sql_handler.cc \ diff --git a/mysql-test/include/mrr_tests.inc b/mysql-test/include/mrr_tests.inc new file mode 100644 index 00000000000..21c419aa1a0 --- /dev/null +++ b/mysql-test/include/mrr_tests.inc @@ -0,0 +1,115 @@ + +create table t1(a int); +show create table t1; +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2(a int); +insert into t2 select A.a + 10*(B.a + 10*C.a) from t1 A, t1 B, t1 C; + + +create table t3 ( + a char(8) not null, b char(8) not null, filler char(200), + key(a) +); +insert into t3 select @a:=concat('c-', 1000+ A.a, '=w'), @a, 'filler' from t2 A; +insert into t3 select concat('c-', 1000+A.a, '=w'), concat('c-', 2000+A.a, '=w'), + 'filler-1' from t2 A; +insert into t3 select concat('c-', 1000+A.a, '=w'), concat('c-', 3000+A.a, '=w'), + 'filler-2' from t2 A; + +# Test empty result set +select a,filler from t3 where a >= 'c-9011=w'; + +# Ok, t3.ref_length=6, limit is 64 => 10 elements fit into the buffer +# Test the cases when buffer gets exhausted at different points in source +# intervals: + +# 1. Split is in the middle of the range +select a,filler from t3 where a >= 'c-1011=w' and a <= 'c-1015=w'; + +# 2. Split is at range edge +select a,filler from t3 where (a>='c-1011=w' and a <= 'c-1013=w') or + (a>='c-1014=w' and a <= 'c-1015=w'); + +# 3. Split is at range edge, with some rows between ranges. +insert into t3 values ('c-1013=z', 'c-1013=z', 'err'); +insert into t3 values ('a-1014=w', 'a-1014=w', 'err'); + +select a,filler from t3 where (a>='c-1011=w' and a <= 'c-1013=w') or + (a>='c-1014=w' and a <= 'c-1015=w'); +delete from t3 where b in ('c-1013=z', 'a-1014=w'); + +# 4. Split is within the equality range. +select a,filler from t3 where a='c-1011=w' or a='c-1012=w' or a='c-1013=w' or + a='c-1014=w' or a='c-1015=w'; + +# 5. Split is at the edge of equality range. +insert into t3 values ('c-1013=w', 'del-me', 'inserted'); +select a,filler from t3 where a='c-1011=w' or a='c-1012=w' or a='c-1013=w' or + a='c-1014=w' or a='c-1015=w'; +delete from t3 where b='del-me'; + +# PK tests are not included here. + +alter table t3 add primary key(b); + +## PK scan tests +# 6. Split is between 'unique' PK ranges +select b,filler from t3 where (b>='c-1011=w' and b<= 'c-1018=w') or + b IN ('c-1019=w', 'c-1020=w', 'c-1021=w', + 'c-1022=w', 'c-1023=w', 'c-1024=w'); + +# 7. Between non-uniq and uniq range +select b,filler from t3 where (b>='c-1011=w' and b<= 'c-1020=w') or + b IN ('c-1021=w', 'c-1022=w', 'c-1023=w'); + +# 8. Between uniq and non-uniq range +select b,filler from t3 where (b>='c-1011=w' and b<= 'c-1018=w') or + b IN ('c-1019=w', 'c-1020=w') or + (b>='c-1021=w' and b<= 'c-1023=w'); +## End of PK scan tests + +# +# Now try different keypart types and special values +# +create table t4 (a varchar(10), b int, c char(10), filler char(200), + key idx1 (a, b, c)); + +# insert buffer_size * 1.5 all-NULL tuples +insert into t4 (filler) select concat('NULL-', 15-a) from t2 order by a limit 15; + +insert into t4 (a,b,c,filler) + select 'b-1',NULL,'c-1', concat('NULL-', 15-a) from t2 order by a limit 15; +insert into t4 (a,b,c,filler) + select 'b-1',NULL,'c-222', concat('NULL-', 15-a) from t2 order by a limit 15; +insert into t4 (a,b,c,filler) + select 'bb-1',NULL,'cc-2', concat('NULL-', 15-a) from t2 order by a limit 15; +insert into t4 (a,b,c,filler) + select 'zz-1',NULL,'cc-2', 'filler-data' from t2 order by a limit 500; + +explain + select * from t4 where a IS NULL and b IS NULL and (c IS NULL or c='no-such-row1' + or c='no-such-row2'); +select * from t4 where a IS NULL and b IS NULL and (c IS NULL or c='no-such-row1' + or c='no-such-row2'); + +explain + select * from t4 where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2'); +select * from t4 where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2'); + +select * from t4 ignore index(idx1) where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2'); +drop table t1, t2, t3, t4; + +# +# Check how ICP works with NULLs and partially-covered indexes +# +create table t1 (a int, b int not null,unique key (a,b),index(b)); +insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6); +create table t2 like t1; +insert into t2 select * from t1; +alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10)); + +select * from t1 where a is null; +select * from t1 where (a is null or a > 0 and a < 3) and b > 7 limit 3; + +select * from t1 where a is null and b=9 or a is null and b=7 limit 3; +drop table t1, t2; diff --git a/mysql-test/r/compress.result b/mysql-test/r/compress.result index 1d3752f09e7..287691448bb 100644 --- a/mysql-test/r/compress.result +++ b/mysql-test/r/compress.result @@ -189,37 +189,37 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range fld1 fld1 4 NULL 4 Using where; Using index select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%'; fld1 fld3 -218401 faithful +012001 flanking +013602 foldout +013606 fingerings 018007 fanatic -228311 fated 018017 featherweight -218022 feed -088303 feminine -058004 Fenton -038017 fetched 018054 fetters -208101 fiftieth -238007 filial -013606 fingerings -218008 finishers -038205 firearm -188505 fitting -202301 Fitzpatrick -238008 fixedly -012001 flanking 018103 flint 018104 flopping +036002 funereal +038017 fetched +038205 firearm +058004 Fenton +088303 feminine +186002 freakish 188007 flurried -013602 foldout +188505 fitting +198006 furthermore +202301 Fitzpatrick +208101 fiftieth +208113 freest +218008 finishers +218022 feed +218401 faithful 226205 foothill -232102 forgivably +226209 furnishings 228306 forthcoming -186002 freakish -208113 freest +228311 fated 231315 freezes -036002 funereal -226209 furnishings -198006 furthermore +232102 forgivably +238007 filial +238008 fixedly select fld3 from t2 where fld3 like "L%" and fld3 = "ok"; fld3 select fld3 from t2 where (fld3 like "C%" and fld3 = "Chantilly"); @@ -1395,15 +1395,15 @@ id select_type table type possible_keys key key_len ref rows Extra explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL NULL NULL NULL NULL 12 @@ -1419,15 +1419,15 @@ id select_type table type possible_keys key key_len ref rows Extra explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0 or companynr > 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; companynr companynr 37 36 diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 88e4bade130..d33d03332a3 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -104,7 +104,7 @@ insert into t1 (b) values ("hello"),("my"),("world"); create table t2 (key (b)) select * from t1; explain select * from t2 where b="world"; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref B B 21 const 1 Using where +1 SIMPLE t2 ref B B 21 const 1 Using index condition select * from t2 where b="world"; a B 3 world diff --git a/mysql-test/r/ctype_collate.result b/mysql-test/r/ctype_collate.result index b42094550bd..51e3cb779e2 100644 --- a/mysql-test/r/ctype_collate.result +++ b/mysql-test/r/ctype_collate.result @@ -566,31 +566,31 @@ INSERT INTO t1 VALUES ('i','i'); INSERT INTO t1 VALUES ('j','j'); EXPLAIN SELECT * FROM t1 WHERE s1='a'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref s1 s1 11 const 1 Using where +1 SIMPLE t1 ref s1 s1 11 const 1 Using index condition EXPLAIN SELECT * FROM t1 WHERE s2='a'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref s2 s2 11 const 1 Using where +1 SIMPLE t1 ref s2 s2 11 const 1 Using index condition EXPLAIN SELECT * FROM t1 WHERE s1='a' COLLATE latin1_german1_ci; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref s1 s1 11 const 1 Using where +1 SIMPLE t1 ref s1 s1 11 const 1 Using index condition EXPLAIN SELECT * FROM t1 WHERE s2='a' COLLATE latin1_german1_ci; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where EXPLAIN SELECT * FROM t1 WHERE s1 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range s1 s1 11 NULL 2 Using where +1 SIMPLE t1 range s1 s1 11 NULL 2 Using index condition; Using MRR EXPLAIN SELECT * FROM t1 WHERE s2 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where EXPLAIN SELECT * FROM t1 WHERE s1 IN ('a','b' COLLATE latin1_german1_ci); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range s1 s1 11 NULL 2 Using where +1 SIMPLE t1 range s1 s1 11 NULL 2 Using index condition; Using MRR EXPLAIN SELECT * FROM t1 WHERE s2 IN ('a','b' COLLATE latin1_german1_ci); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where EXPLAIN SELECT * FROM t1 WHERE s1 LIKE 'a' COLLATE latin1_german1_ci; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range s1 s1 11 NULL 1 Using where +1 SIMPLE t1 range s1 s1 11 NULL 1 Using index condition; Using MRR EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result index 47797af3cbe..0ebff29fb98 100644 --- a/mysql-test/r/ctype_cp1251.result +++ b/mysql-test/r/ctype_cp1251.result @@ -65,8 +65,8 @@ insert into t1 (a) values ('air'), ('tn_fakira'),('vw_silvia'),('vw_starshi'),('vw_geo'),('vw_b0x1'); select * from t1 where a like 'we_%'; a b -we_iliyan NULL +we_toshko NULL we_ivo NULL +we_iliyan NULL we_martin NULL -we_toshko NULL drop table t1; diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index e0324af8cfd..4febf4638b0 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -174,7 +174,7 @@ INSERT INTO t3 VALUES (1,'1'),(2,'2'),(1,'1'),(2,'2'); explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 4 Using temporary -1 SIMPLE t3 ref a a 5 test.t1.b 2 Using where; Using index +1 SIMPLE t3 ref a a 5 test.t1.b 2 Using index 1 SIMPLE t2 index a a 4 NULL 5 Using where; Using index; Distinct; Using join buffer SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a; a @@ -190,7 +190,7 @@ insert into t3 select * from t4; explain select distinct t1.a from t1,t3 where t1.a=t3.a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary -1 SIMPLE t3 ref a a 5 test.t1.a 11 Using where; Using index; Distinct +1 SIMPLE t3 ref a a 5 test.t1.a 11 Using index; Distinct select distinct t1.a from t1,t3 where t1.a=t3.a; a 1 diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result index a81ff554ca2..336f44356b4 100644 --- a/mysql-test/r/explain.result +++ b/mysql-test/r/explain.result @@ -13,7 +13,7 @@ id str 3 foo explain select * from t1 where str is null; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref str str 11 const 1 Using where +1 SIMPLE t1 ref str str 11 const 1 Using index condition explain select * from t1 where str="foo"; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 const str str 11 const 1 @@ -50,7 +50,7 @@ insert into ÔÁ (ËÏÌ0) values (1); insert into ÔÁ (ËÏÌ0) values (2); explain select ËÏÌ0 from ÔÁ where ËÏÌ0=1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE ÔÁ ref ÉÎÄ0,ÉÎÄ01 ÉÎÄ0 5 const 1 Using where; Using index +1 SIMPLE ÔÁ ref ÉÎÄ0,ÉÎÄ01 ÉÎÄ0 5 const 1 Using index drop table ÔÁÂ; set names latin1; select 3 into @v1; diff --git a/mysql-test/r/func_concat.result b/mysql-test/r/func_concat.result index 75b4888fbb2..b2b5a956fac 100644 --- a/mysql-test/r/func_concat.result +++ b/mysql-test/r/func_concat.result @@ -117,6 +117,6 @@ EXPLAIN SELECT CONCAT('gui_', t2.a), t1.d FROM t2 LEFT JOIN t1 ON t1.a = CONCAT('gui_', t2.a) AND t1.b = 'a' AND t1.c = 'b'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 index NULL PRIMARY 102 NULL 3 Using index -1 SIMPLE t1 eq_ref PRIMARY,a PRIMARY 318 func,const,const 1 +1 SIMPLE t1 eq_ref PRIMARY,a PRIMARY 318 func,const,const 1 Using where DROP TABLE t1, t2; # End of 5.1 tests diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index 3d989ad1730..189efc1d4bf 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -1333,7 +1333,7 @@ CREATE TABLE t2( a INT, b INT, c INT, KEY(a, b) ); INSERT INTO t2 ( a, b, c ) VALUES ( 1, NULL, 2 ), ( 1, 3, 4 ), ( 1, 4, 4 ); EXPLAIN SELECT MIN(b), MIN(c) FROM t2 WHERE a = 1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref a a 5 const 2 Using where +1 SIMPLE t2 ref a a 5 const 2 SELECT MIN(b), MIN(c) FROM t2 WHERE a = 1; MIN(b) MIN(c) 3 2 diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index 88a822a2fa6..6e0a3d98e86 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -241,7 +241,7 @@ insert into t2 select C.a*2+1, 'yes' from t1 C; explain select * from t2 where a NOT IN (0, 2,4,6,8,10,12,14,16,18); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 5 NULL 12 Using where +1 SIMPLE t2 range a a 5 NULL 12 Using index condition; Using MRR select * from t2 where a NOT IN (0, 2,4,6,8,10,12,14,16,18); a filler 1 yes @@ -256,10 +256,10 @@ a filler 19 yes explain select * from t2 force index(a) where a NOT IN (2,2,2,2,2,2); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 5 NULL 912 Using where +1 SIMPLE t2 range a a 5 NULL 912 Using index condition; Using MRR explain select * from t2 force index(a) where a <> 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 5 NULL 912 Using where +1 SIMPLE t2 range a a 5 NULL 912 Using index condition; Using MRR drop table t2; create table t2 (a datetime, filler char(200), key(a)); insert into t2 select '2006-04-25 10:00:00' + interval C.a minute, @@ -271,7 +271,7 @@ select * from t2 where a NOT IN ( '2006-04-25 10:00:00','2006-04-25 10:02:00','2006-04-25 10:04:00', '2006-04-25 10:06:00', '2006-04-25 10:08:00'); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 9 NULL 18 Using where +1 SIMPLE t2 range a a 9 NULL 18 Using index condition; Using MRR select * from t2 where a NOT IN ( '2006-04-25 10:00:00','2006-04-25 10:02:00','2006-04-25 10:04:00', '2006-04-25 10:06:00', '2006-04-25 10:08:00'); @@ -295,7 +295,7 @@ insert into t2 values ('fon', '1'), ('fop','1'), ('barbaq','1'), ('barbas','1'), ('bazbazbay', '1'),('zz','1'); explain select * from t2 where a not in('foo','barbar', 'bazbazbaz'); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 13 NULL 7 Using where +1 SIMPLE t2 range a a 13 NULL 7 Using index condition; Using MRR drop table t2; create table t2 (a decimal(10,5), filler char(200), key(a)); insert into t2 select 345.67890, 'no' from t1 A, t1 B; @@ -306,7 +306,7 @@ insert into t2 values (0, '1'), (22334.123,'1'), (33333,'1'), explain select * from t2 where a not in (345.67890, 43245.34, 64224.56344); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 7 NULL 7 Using where +1 SIMPLE t2 range a a 7 NULL 7 Using index condition; Using MRR select * from t2 where a not in (345.67890, 43245.34, 64224.56344); a filler 0.00000 1 diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result index ddf675e2f73..fe0f5f39aca 100644 --- a/mysql-test/r/heap.result +++ b/mysql-test/r/heap.result @@ -204,7 +204,7 @@ key a (a) INSERT INTO t1 VALUES (10), (10), (10); EXPLAIN SELECT * FROM t1 WHERE a=10; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 3 Using where +1 SIMPLE t1 ref a a 5 const 3 SELECT * FROM t1 WHERE a=10; a 10 diff --git a/mysql-test/r/index_merge_myisam.result b/mysql-test/r/index_merge_myisam.result index c639b20de91..0eecf24df14 100644 --- a/mysql-test/r/index_merge_myisam.result +++ b/mysql-test/r/index_merge_myisam.result @@ -19,7 +19,7 @@ Table Op Msg_type Msg_text test.t0 analyze status OK explain select * from t0 where key1 < 3 or key1 > 1020; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 range i1 i1 4 NULL 78 Using where +1 SIMPLE t0 range i1 i1 4 NULL 78 Using index condition; Using MRR explain select * from t0 where key1 < 3 or key2 > 1020; id select_type table type possible_keys key key_len ref rows Extra @@ -72,7 +72,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 17 Using sort_union(i1,i2); Using where explain select * from t0 where key2 = 45 or key1 <=> null; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 range i1,i2 i2 4 NULL 1 Using where +1 SIMPLE t0 range i1,i2 i2 4 NULL 1 Using where; Using MRR explain select * from t0 where key2 = 45 or key1 is not null; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 ALL i1,i2 NULL NULL NULL 1024 Using where @@ -115,7 +115,7 @@ id select_type table type possible_keys key key_len ref rows Extra explain select * from t0 where (key1 < 3 or key2 < 3) and (key3 < 100); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 range i1,i2,i3 i3 4 NULL 95 Using where +1 SIMPLE t0 range i1,i2,i3 i3 4 NULL 95 Using index condition; Using where; Using MRR explain select * from t0 where (key1 < 3 or key2 < 3) and (key3 < 1000); id select_type table type possible_keys key key_len ref rows Extra @@ -275,7 +275,7 @@ id select_type table type possible_keys key key_len ref rows Extra explain select * from t0,t1 where t0.key1 < 3 and (t1.key1 = t0.key1 or t1.key8 = t0.key1); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 range i1 i1 4 NULL 3 Using where +1 SIMPLE t0 range i1 i1 4 NULL 3 Using index condition; Using MRR 1 SIMPLE t1 ALL i1,i8 NULL NULL NULL 1024 Range checked for each record (index map: 0x81) explain select * from t1 where key1=3 or key2=4 union select * from t1 where key1<4 or key3=5; @@ -1326,19 +1326,19 @@ primary key (pk1, pk2) ); explain select * from t1 where pk1 = 1 and pk2 < 80 and key1=0; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,key1 PRIMARY 8 NULL 7 Using where +1 SIMPLE t1 range PRIMARY,key1 PRIMARY 8 NULL 7 Using index condition; Using where; Using MRR select * from t1 where pk1 = 1 and pk2 < 80 and key1=0; pk1 pk2 key1 key2 pktail1ok pktail2ok pktail3bad pktail4bad pktail5bad pk2copy badkey filler1 filler2 -1 10 0 0 0 0 0 0 0 10 0 filler-data-10 filler2 -1 11 0 0 0 0 0 0 0 11 0 filler-data-11 filler2 -1 12 0 0 0 0 0 0 0 12 0 filler-data-12 filler2 -1 13 0 0 0 0 0 0 0 13 0 filler-data-13 filler2 -1 14 0 0 0 0 0 0 0 14 0 filler-data-14 filler2 -1 15 0 0 0 0 0 0 0 15 0 filler-data-15 filler2 -1 16 0 0 0 0 0 0 0 16 0 filler-data-16 filler2 -1 17 0 0 0 0 0 0 0 17 0 filler-data-17 filler2 -1 18 0 0 0 0 0 0 0 18 0 filler-data-18 filler2 1 19 0 0 0 0 0 0 0 19 0 filler-data-19 filler2 +1 18 0 0 0 0 0 0 0 18 0 filler-data-18 filler2 +1 17 0 0 0 0 0 0 0 17 0 filler-data-17 filler2 +1 16 0 0 0 0 0 0 0 16 0 filler-data-16 filler2 +1 15 0 0 0 0 0 0 0 15 0 filler-data-15 filler2 +1 14 0 0 0 0 0 0 0 14 0 filler-data-14 filler2 +1 13 0 0 0 0 0 0 0 13 0 filler-data-13 filler2 +1 12 0 0 0 0 0 0 0 12 0 filler-data-12 filler2 +1 11 0 0 0 0 0 0 0 11 0 filler-data-11 filler2 +1 10 0 0 0 0 0 0 0 10 0 filler-data-10 filler2 explain select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index_merge key1,key2 key1,key2 4,4 NULL 1 Using intersect(key1,key2); Using where diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 44c436e00ff..7fb1cd5f037 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1293,7 +1293,7 @@ count(*) 623 explain select * from t1 where c between 1 and 2500; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 5 NULL # Using where +1 SIMPLE t1 range c c 5 NULL # Using index condition; Using MRR update t1 set c=a; explain select * from t1 where c between 1 and 2500; id select_type table type possible_keys key key_len ref rows Extra @@ -1986,7 +1986,7 @@ qq *a *a*a * explain select * from t1 where v='a'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v,v_2 # 13 const # Using where +1 SIMPLE t1 ref v,v_2 # 13 const # Using index condition select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -2162,7 +2162,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref v v 303 const # Using where; Using index explain select * from t1 where v='a'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # Using where +1 SIMPLE t1 ref v v 303 const # Using index condition select v,count(*) from t1 group by v limit 10; v count(*) a 1 diff --git a/mysql-test/r/innodb_mrr.result b/mysql-test/r/innodb_mrr.result new file mode 100644 index 00000000000..bf72ce822df --- /dev/null +++ b/mysql-test/r/innodb_mrr.result @@ -0,0 +1,404 @@ +drop table if exists t1,t2,t3,t4; +set @save_storage_engine= @@storage_engine; +set storage_engine=InnoDB; +create table t1(a int); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2(a int); +insert into t2 select A.a + 10*(B.a + 10*C.a) from t1 A, t1 B, t1 C; +create table t3 ( +a char(8) not null, b char(8) not null, filler char(200), +key(a) +); +insert into t3 select @a:=concat('c-', 1000+ A.a, '=w'), @a, 'filler' from t2 A; +insert into t3 select concat('c-', 1000+A.a, '=w'), concat('c-', 2000+A.a, '=w'), +'filler-1' from t2 A; +insert into t3 select concat('c-', 1000+A.a, '=w'), concat('c-', 3000+A.a, '=w'), +'filler-2' from t2 A; +select a,filler from t3 where a >= 'c-9011=w'; +a filler +select a,filler from t3 where a >= 'c-1011=w' and a <= 'c-1015=w'; +a filler +c-1011=w filler +c-1012=w filler +c-1013=w filler +c-1014=w filler +c-1015=w filler +c-1011=w filler-1 +c-1012=w filler-1 +c-1013=w filler-1 +c-1014=w filler-1 +c-1015=w filler-1 +c-1011=w filler-2 +c-1012=w filler-2 +c-1013=w filler-2 +c-1014=w filler-2 +c-1015=w filler-2 +select a,filler from t3 where (a>='c-1011=w' and a <= 'c-1013=w') or +(a>='c-1014=w' and a <= 'c-1015=w'); +a filler +c-1011=w filler +c-1012=w filler +c-1013=w filler +c-1014=w filler +c-1015=w filler +c-1011=w filler-1 +c-1012=w filler-1 +c-1013=w filler-1 +c-1014=w filler-1 +c-1015=w filler-1 +c-1011=w filler-2 +c-1012=w filler-2 +c-1013=w filler-2 +c-1014=w filler-2 +c-1015=w filler-2 +insert into t3 values ('c-1013=z', 'c-1013=z', 'err'); +insert into t3 values ('a-1014=w', 'a-1014=w', 'err'); +select a,filler from t3 where (a>='c-1011=w' and a <= 'c-1013=w') or +(a>='c-1014=w' and a <= 'c-1015=w'); +a filler +c-1011=w filler +c-1012=w filler +c-1013=w filler +c-1014=w filler +c-1015=w filler +c-1011=w filler-1 +c-1012=w filler-1 +c-1013=w filler-1 +c-1014=w filler-1 +c-1015=w filler-1 +c-1011=w filler-2 +c-1012=w filler-2 +c-1013=w filler-2 +c-1014=w filler-2 +c-1015=w filler-2 +delete from t3 where b in ('c-1013=z', 'a-1014=w'); +select a,filler from t3 where a='c-1011=w' or a='c-1012=w' or a='c-1013=w' or +a='c-1014=w' or a='c-1015=w'; +a filler +c-1011=w filler +c-1012=w filler +c-1013=w filler +c-1014=w filler +c-1015=w filler +c-1011=w filler-1 +c-1012=w filler-1 +c-1013=w filler-1 +c-1014=w filler-1 +c-1015=w filler-1 +c-1011=w filler-2 +c-1012=w filler-2 +c-1013=w filler-2 +c-1014=w filler-2 +c-1015=w filler-2 +insert into t3 values ('c-1013=w', 'del-me', 'inserted'); +select a,filler from t3 where a='c-1011=w' or a='c-1012=w' or a='c-1013=w' or +a='c-1014=w' or a='c-1015=w'; +a filler +c-1011=w filler +c-1012=w filler +c-1013=w filler +c-1014=w filler +c-1015=w filler +c-1011=w filler-1 +c-1012=w filler-1 +c-1013=w filler-1 +c-1014=w filler-1 +c-1015=w filler-1 +c-1011=w filler-2 +c-1012=w filler-2 +c-1013=w filler-2 +c-1014=w filler-2 +c-1015=w filler-2 +c-1013=w inserted +delete from t3 where b='del-me'; +alter table t3 add primary key(b); +select b,filler from t3 where (b>='c-1011=w' and b<= 'c-1018=w') or +b IN ('c-1019=w', 'c-1020=w', 'c-1021=w', +'c-1022=w', 'c-1023=w', 'c-1024=w'); +b filler +c-1011=w filler +c-1012=w filler +c-1013=w filler +c-1014=w filler +c-1015=w filler +c-1016=w filler +c-1017=w filler +c-1018=w filler +c-1019=w filler +c-1020=w filler +c-1021=w filler +c-1022=w filler +c-1023=w filler +c-1024=w filler +select b,filler from t3 where (b>='c-1011=w' and b<= 'c-1020=w') or +b IN ('c-1021=w', 'c-1022=w', 'c-1023=w'); +b filler +c-1011=w filler +c-1012=w filler +c-1013=w filler +c-1014=w filler +c-1015=w filler +c-1016=w filler +c-1017=w filler +c-1018=w filler +c-1019=w filler +c-1020=w filler +c-1021=w filler +c-1022=w filler +c-1023=w filler +select b,filler from t3 where (b>='c-1011=w' and b<= 'c-1018=w') or +b IN ('c-1019=w', 'c-1020=w') or +(b>='c-1021=w' and b<= 'c-1023=w'); +b filler +c-1011=w filler +c-1012=w filler +c-1013=w filler +c-1014=w filler +c-1015=w filler +c-1016=w filler +c-1017=w filler +c-1018=w filler +c-1019=w filler +c-1020=w filler +c-1021=w filler +c-1022=w filler +c-1023=w filler +create table t4 (a varchar(10), b int, c char(10), filler char(200), +key idx1 (a, b, c)); +insert into t4 (filler) select concat('NULL-', 15-a) from t2 order by a limit 15; +insert into t4 (a,b,c,filler) +select 'b-1',NULL,'c-1', concat('NULL-', 15-a) from t2 order by a limit 15; +insert into t4 (a,b,c,filler) +select 'b-1',NULL,'c-222', concat('NULL-', 15-a) from t2 order by a limit 15; +insert into t4 (a,b,c,filler) +select 'bb-1',NULL,'cc-2', concat('NULL-', 15-a) from t2 order by a limit 15; +insert into t4 (a,b,c,filler) +select 'zz-1',NULL,'cc-2', 'filler-data' from t2 order by a limit 500; +explain +select * from t4 where a IS NULL and b IS NULL and (c IS NULL or c='no-such-row1' + or c='no-such-row2'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t4 range idx1 idx1 29 NULL 16 Using index condition; Using MRR +select * from t4 where a IS NULL and b IS NULL and (c IS NULL or c='no-such-row1' + or c='no-such-row2'); +a b c filler +NULL NULL NULL NULL-15 +NULL NULL NULL NULL-14 +NULL NULL NULL NULL-13 +NULL NULL NULL NULL-12 +NULL NULL NULL NULL-11 +NULL NULL NULL NULL-10 +NULL NULL NULL NULL-9 +NULL NULL NULL NULL-8 +NULL NULL NULL NULL-7 +NULL NULL NULL NULL-6 +NULL NULL NULL NULL-5 +NULL NULL NULL NULL-4 +NULL NULL NULL NULL-3 +NULL NULL NULL NULL-2 +NULL NULL NULL NULL-1 +explain +select * from t4 where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t4 range idx1 idx1 29 NULL 32 Using index condition; Using MRR +select * from t4 where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2'); +a b c filler +b-1 NULL c-1 NULL-15 +b-1 NULL c-1 NULL-14 +b-1 NULL c-1 NULL-13 +b-1 NULL c-1 NULL-12 +b-1 NULL c-1 NULL-11 +b-1 NULL c-1 NULL-10 +b-1 NULL c-1 NULL-9 +b-1 NULL c-1 NULL-8 +b-1 NULL c-1 NULL-7 +b-1 NULL c-1 NULL-6 +b-1 NULL c-1 NULL-5 +b-1 NULL c-1 NULL-4 +b-1 NULL c-1 NULL-3 +b-1 NULL c-1 NULL-2 +b-1 NULL c-1 NULL-1 +bb-1 NULL cc-2 NULL-15 +bb-1 NULL cc-2 NULL-14 +bb-1 NULL cc-2 NULL-13 +bb-1 NULL cc-2 NULL-12 +bb-1 NULL cc-2 NULL-11 +bb-1 NULL cc-2 NULL-10 +bb-1 NULL cc-2 NULL-9 +bb-1 NULL cc-2 NULL-8 +bb-1 NULL cc-2 NULL-7 +bb-1 NULL cc-2 NULL-6 +bb-1 NULL cc-2 NULL-5 +bb-1 NULL cc-2 NULL-4 +bb-1 NULL cc-2 NULL-3 +bb-1 NULL cc-2 NULL-2 +bb-1 NULL cc-2 NULL-1 +select * from t4 ignore index(idx1) where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2'); +a b c filler +b-1 NULL c-1 NULL-15 +b-1 NULL c-1 NULL-14 +b-1 NULL c-1 NULL-13 +b-1 NULL c-1 NULL-12 +b-1 NULL c-1 NULL-11 +b-1 NULL c-1 NULL-10 +b-1 NULL c-1 NULL-9 +b-1 NULL c-1 NULL-8 +b-1 NULL c-1 NULL-7 +b-1 NULL c-1 NULL-6 +b-1 NULL c-1 NULL-5 +b-1 NULL c-1 NULL-4 +b-1 NULL c-1 NULL-3 +b-1 NULL c-1 NULL-2 +b-1 NULL c-1 NULL-1 +bb-1 NULL cc-2 NULL-15 +bb-1 NULL cc-2 NULL-14 +bb-1 NULL cc-2 NULL-13 +bb-1 NULL cc-2 NULL-12 +bb-1 NULL cc-2 NULL-11 +bb-1 NULL cc-2 NULL-10 +bb-1 NULL cc-2 NULL-9 +bb-1 NULL cc-2 NULL-8 +bb-1 NULL cc-2 NULL-7 +bb-1 NULL cc-2 NULL-6 +bb-1 NULL cc-2 NULL-5 +bb-1 NULL cc-2 NULL-4 +bb-1 NULL cc-2 NULL-3 +bb-1 NULL cc-2 NULL-2 +bb-1 NULL cc-2 NULL-1 +drop table t1, t2, t3, t4; +create table t1 (a int, b int not null,unique key (a,b),index(b)); +insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6); +create table t2 like t1; +insert into t2 select * from t1; +alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10)); +select * from t1 where a is null; +a b c +NULL 7 0 +NULL 9 0 +NULL 9 0 +select * from t1 where (a is null or a > 0 and a < 3) and b > 7 limit 3; +a b c +NULL 9 0 +NULL 9 0 +select * from t1 where a is null and b=9 or a is null and b=7 limit 3; +a b c +NULL 7 0 +NULL 9 0 +NULL 9 0 +drop table t1, t2; +set storage_engine= @save_storage_engine; +set @read_rnd_buffer_size_save= @@read_rnd_buffer_size; +set read_rnd_buffer_size=64; +Warnings: +Warning 1292 Truncated incorrect read_rnd_buffer_size value: '64' +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2(a char(8), b char(8), c char(8), filler char(100), key(a,b,c) ) engine=InnoDB; +insert into t2 select +concat('a-', 1000 + A.a, '-a'), +concat('b-', 1000 + B.a, '-b'), +concat('c-', 1000 + C.a, '-c'), +'filler' +from t1 A, t1 B, t1 C; +explain +select count(length(a) + length(filler)) from t2 where a>='a-1000-a' and a <'a-1001-a'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range a a 9 NULL 99 Using index condition; Using MRR +select count(length(a) + length(filler)) from t2 where a>='a-1000-a' and a <'a-1001-a'; +count(length(a) + length(filler)) +100 +drop table t2; +create table t2 (a char(100), b char(100), c char(100), d int, +filler char(10), key(d), primary key (a,b,c)) engine= innodb; +insert into t2 select A.a, B.a, B.a, A.a, 'filler' from t1 A, t1 B; +explain select * from t2 force index (d) where d < 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range d d 5 NULL 47 Using index condition; Using MRR +drop table t2; +drop table t1; +set @@read_rnd_buffer_size= @read_rnd_buffer_size_save; +create table t1 (f1 int not null, f2 int not null,f3 int not null, f4 char(1), primary key (f1,f2), key ix(f3))Engine=InnoDB; +select * from t1 where (f3>=5 and f3<=10) or (f3>=1 and f3<=4); +f1 f2 f3 f4 +1 1 1 A +2 2 2 A +3 3 3 A +4 4 4 A +5 5 5 A +6 6 6 A +7 7 7 A +8 8 8 A +9 9 9 A +10 10 10 A +drop table t1; + +BUG#37977: Wrong result returned on GROUP BY + OR + Innodb + +CREATE TABLE t1 ( +`pk` int(11) NOT NULL AUTO_INCREMENT, +`int_nokey` int(11) NOT NULL, +`int_key` int(11) NOT NULL, +`date_key` date NOT NULL, +`date_nokey` date NOT NULL, +`time_key` time NOT NULL, +`time_nokey` time NOT NULL, +`datetime_key` datetime NOT NULL, +`datetime_nokey` datetime NOT NULL, +`varchar_key` varchar(5) DEFAULT NULL, +`varchar_nokey` varchar(5) DEFAULT NULL, +PRIMARY KEY (`pk`), +KEY `int_key` (`int_key`), +KEY `date_key` (`date_key`), +KEY `time_key` (`time_key`), +KEY `datetime_key` (`datetime_key`), +KEY `varchar_key` (`varchar_key`) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES +(1,5,5,'2009-10-16','2009-10-16','09:28:15','09:28:15','2007-09-14 05:34:08','2007-09-14 05:34:08','qk','qk'), +(2,6,6,'0000-00-00','0000-00-00','23:06:39','23:06:39','0000-00-00 00:00:00','0000-00-00 00:00:00','j','j'), +(3,10,10,'2000-12-18','2000-12-18','22:16:19','22:16:19','2006-11-04 15:42:50','2006-11-04 15:42:50','aew','aew'), +(4,0,0,'2001-09-18','2001-09-18','00:00:00','00:00:00','2004-03-23 13:23:35','2004-03-23 13:23:35',NULL,NULL), +(5,6,6,'2007-08-16','2007-08-16','22:13:38','22:13:38','2004-08-19 11:01:28','2004-08-19 11:01:28','qu','qu'); +select pk from t1 WHERE `varchar_key` > 'kr' group by pk; +pk +1 +5 +select pk from t1 WHERE `int_nokey` IS NULL OR `varchar_key` > 'kr' group by pk; +pk +1 +5 +drop table t1; +# +# BUG#39447: Error with NOT NULL condition and LIMIT 1 +# +CREATE TABLE t1 ( +id int(11) NOT NULL, +parent_id int(11) DEFAULT NULL, +name varchar(10) DEFAULT NULL, +PRIMARY KEY (id), +KEY ind_parent_id (parent_id) +) ENGINE=InnoDB; +insert into t1 (id, parent_id, name) values +(10,NULL,'A'), +(20,10,'B'), +(30,10,'C'), +(40,NULL,'D'), +(50,40,'E'), +(60,40,'F'), +(70,NULL,'J'); +SELECT id FROM t1 WHERE parent_id IS NOT NULL ORDER BY id DESC LIMIT 1; +id +60 +This must show type=index, extra=Using where +explain SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE parent_id IS NOT NULL ORDER BY id DESC LIMIT 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL 1 Using where +SELECT * FROM t1 WHERE parent_id IS NOT NULL ORDER BY id DESC LIMIT 1; +id parent_id name +60 40 F +drop table t1; diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index 3ff5f04b6c6..09f99fcf80e 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -356,7 +356,7 @@ SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id WHERE t1.name LIKE 'A%'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index PRIMARY,name name 23 NULL 3 Using where; Using index -1 SIMPLE t2 ref fkey fkey 5 test.t1.id 1 Using where; Using index +1 SIMPLE t2 ref fkey fkey 5 test.t1.id 1 Using index EXPLAIN SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id WHERE t1.name LIKE 'A%' OR FALSE; diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result index 736ecf1d90e..2f75aee6380 100644 --- a/mysql-test/r/join.result +++ b/mysql-test/r/join.result @@ -869,7 +869,7 @@ insert into t3 select * from t2 where a < 800; explain select * from t2,t3 where t2.a < 200 and t2.b=t3.b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL a,b NULL NULL NULL 1000 Using where -1 SIMPLE t3 ref b b 5 test.t2.b 1 Using where +1 SIMPLE t3 ref b b 5 test.t2.b 1 drop table t1, t2, t3; create table t1 (a int); insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); diff --git a/mysql-test/r/join_nested.result b/mysql-test/r/join_nested.result index 2bdac08e7fd..6718274184d 100644 --- a/mysql-test/r/join_nested.result +++ b/mysql-test/r/join_nested.result @@ -74,7 +74,7 @@ WHERE t3.a=1 OR t3.c IS NULL; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on((`test`.`t4`.`b` = `test`.`t2`.`b`)) where ((`test`.`t3`.`a` = 1) or isnull(`test`.`t3`.`c`)) SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b @@ -150,7 +150,7 @@ WHERE t3.a>1 OR t3.c IS NULL; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on((`test`.`t4`.`b` = `test`.`t2`.`b`)) where ((`test`.`t3`.`a` > 1) or isnull(`test`.`t3`.`c`)) @@ -180,7 +180,7 @@ WHERE (t3.a>1 OR t3.c IS NULL) AND id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on((`test`.`t4`.`b` = `test`.`t2`.`b`)) where (((`test`.`t3`.`a` > 1) or isnull(`test`.`t3`.`c`)) and ((`test`.`t5`.`a` < 3) or isnull(`test`.`t5`.`c`))) @@ -230,7 +230,7 @@ ON t7.b=t8.b AND t6.b < 10; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using join buffer -1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t7`.`b` = `test`.`t8`.`b`) and (`test`.`t6`.`b` < 10))) where 1 SELECT t6.a,t6.b,t7.a,t7.b,t8.a,t8.b @@ -546,12 +546,12 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`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`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) where ((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`))) SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b, @@ -837,8 +837,8 @@ WHERE t1.a <= 2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: 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`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t1` join `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) where (`test`.`t1`.`a` <= 2) CREATE INDEX idx_b ON t2(b); @@ -851,7 +851,7 @@ ON t3.a=1 AND t3.b=t2.b AND t2.b=t4.b; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using join buffer -1 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 2 100.00 +1 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 2 100.00 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(((`test`.`t3`.`a` = 1) and (`test`.`t3`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` = `test`.`t4`.`b`))) where 1 @@ -1054,8 +1054,8 @@ t0.b=t1.b AND (t8.b=t9.b OR t8.c IS NULL) AND (t9.a=1); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t0 ref idx_a idx_a 5 const 1 100.00 Using where -1 SIMPLE t1 ref idx_b idx_b 5 test.t0.b 2 100.00 Using where +1 SIMPLE t0 ref idx_a idx_a 5 const 1 100.00 +1 SIMPLE t1 ref idx_b idx_b 5 test.t0.b 2 100.00 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 100.00 Using where @@ -1196,13 +1196,13 @@ INSERT INTO t3 VALUES (0), (1), (2), (3), (4), (5); EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON c < 3 and b = c; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL a 5 NULL 21 Using index -1 SIMPLE t3 index c c 5 NULL 6 Using index +1 SIMPLE t3 index c c 5 NULL 6 Using where; Using index 1 SIMPLE t2 ref b b 5 test.t3.c 2 Using index EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL a 5 NULL 21 Using index 1 SIMPLE t3 index c c 5 NULL 6 Using index -1 SIMPLE t2 ref b b 5 test.t3.c 2 Using index +1 SIMPLE t2 ref b b 5 test.t3.c 2 Using where; Using index SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; a b c NULL 0 0 @@ -1273,7 +1273,7 @@ EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL a 5 NULL 21 Using index 1 SIMPLE t3 index c c 5 NULL 0 Using index -1 SIMPLE t2 ref b b 5 test.t3.c 2 Using index +1 SIMPLE t2 ref b b 5 test.t3.c 2 Using where; Using index SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; a b c NULL NULL NULL @@ -1317,8 +1317,8 @@ c11 c21 c31 EXPLAIN SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL NULL NULL NULL NULL 0 -1 SIMPLE t3 ALL NULL NULL NULL NULL 0 +1 SIMPLE t2 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE t3 ALL NULL NULL NULL NULL 0 Using where DROP TABLE t1,t2,t3; CREATE TABLE t1 (goods int(12) NOT NULL, price varchar(128) NOT NULL); INSERT INTO t1 VALUES (23, 2340), (26, 9900); @@ -1447,12 +1447,12 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL X 1 SIMPLE t3 ref a a 5 test.t2.b X 1 SIMPLE t5 ref a a 5 test.t3.b X -1 SIMPLE t4 ref a a 5 test.t3.b X Using where +1 SIMPLE t4 ref a a 5 test.t3.b X Using index condition explain select * from (t4 join t6 on t6.a=t4.b) right join t3 on t4.a=t3.b join t2 left join (t5 join t7 on t7.a=t5.b) on t5.a=t2.b where t3.a<=>t2.b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL X -1 SIMPLE t3 ref a a 5 test.t2.b X Using where +1 SIMPLE t3 ref a a 5 test.t2.b X Using index condition 1 SIMPLE t4 ref a a 5 test.t3.b X 1 SIMPLE t6 ref a a 5 test.t4.b X 1 SIMPLE t5 ref a a 5 test.t2.b X diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index 1e4fc91b8bd..5b81ea0e4fa 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -630,7 +630,7 @@ insert into t2 values (10,1),(20,2),(30,3); explain select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 index NULL PRIMARY 4 NULL 3 Using index -1 SIMPLE t1 const PRIMARY PRIMARY 2 const 1 Using index +1 SIMPLE t1 const PRIMARY PRIMARY 2 const 1 Using where; Using index select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30; fooID barID fooID 10 1 NULL @@ -688,8 +688,8 @@ a1 a2 b1 b2 c1 c2 explain select * from t1 left join t2 on b1 = a1 left join t3 on c1 = a1 and b1 is null; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where drop table t1, t2, t3; create table t1 ( a int(11), diff --git a/mysql-test/r/join_outer_innodb.result b/mysql-test/r/join_outer_innodb.result index e8a2d6f668b..56e557ec881 100644 --- a/mysql-test/r/join_outer_innodb.result +++ b/mysql-test/r/join_outer_innodb.result @@ -9,7 +9,7 @@ SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id WHERE t1.name LIKE 'A%'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index PRIMARY,name name 23 NULL 3 Using where; Using index -1 SIMPLE t2 ref fkey fkey 5 test.t1.id 1 Using where; Using index +1 SIMPLE t2 ref fkey fkey 5 test.t1.id 1 Using index EXPLAIN SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id WHERE t1.name LIKE 'A%' OR FALSE; diff --git a/mysql-test/r/key_cache.result b/mysql-test/r/key_cache.result index 08d8059f61b..8450b4632e8 100644 --- a/mysql-test/r/key_cache.result +++ b/mysql-test/r/key_cache.result @@ -134,7 +134,7 @@ i explain select count(*) from t1, t2 where t1.p = t2.i; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 2 Using index -1 SIMPLE t2 ref k1 k1 5 test.t1.p 2 Using where; Using index +1 SIMPLE t2 ref k1 k1 5 test.t1.p 2 Using index select count(*) from t1, t2 where t1.p = t2.i; count(*) 3 diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index e3633404db1..c49cf801fa7 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -673,7 +673,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN SELECT * FROM t1 WHERE fileset_id = 2 AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,files PRIMARY 35 NULL 5 Using where +1 SIMPLE t1 range PRIMARY,files PRIMARY 35 NULL 5 Using index condition; Using MRR EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2 AND file_code = '0000000115' LIMIT 1; id select_type table type possible_keys key key_len ref rows Extra diff --git a/mysql-test/r/mix2_myisam.result b/mysql-test/r/mix2_myisam.result index e0a3d1af089..676fd06fc8b 100644 --- a/mysql-test/r/mix2_myisam.result +++ b/mysql-test/r/mix2_myisam.result @@ -1114,11 +1114,11 @@ count(*) 29267 explain select * from t1 where c between 1 and 2500; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 5 NULL # Using where +1 SIMPLE t1 range c c 5 NULL # Using index condition; Using MRR update t1 set c=a; explain select * from t1 where c between 1 and 2500; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 5 NULL # Using where +1 SIMPLE t1 range c c 5 NULL # Using index condition; Using MRR drop table t1,t2; create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=MyISAM; insert into t1 (id) values (null),(null),(null),(null),(null); @@ -1559,7 +1559,7 @@ qq *a *a*a * explain select * from t1 where v='a'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v,v_2 # 13 const # Using where +1 SIMPLE t1 ref v,v_2 # 13 const # Using index condition select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -1735,7 +1735,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref v v 303 const # Using where; Using index explain select * from t1 where v='a'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # Using where +1 SIMPLE t1 ref v v 303 const # Using index condition select v,count(*) from t1 group by v limit 10; v count(*) a 1 diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 0a02c25c322..c74ffb3ae6f 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -358,7 +358,7 @@ id select_type table type possible_keys key key_len ref rows Extra explain select * from t1,t2 where t1.b=t2.b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL b NULL NULL NULL 2 -1 SIMPLE t1 ref b b 5 test.t2.b 1 Using where +1 SIMPLE t1 ref b b 5 test.t2.b 1 explain select * from t1,t2 force index(c) where t1.a=t2.a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 @@ -368,10 +368,10 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where explain select * from t1 force index (a) where a=0 or a=2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 4 NULL 4 Using where +1 SIMPLE t1 range a a 4 NULL 4 Using index condition; Using MRR explain select * from t1 where c=1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c,c_2 c 5 const 1 Using where +1 SIMPLE t1 ref c,c_2 c 5 const 1 explain select * from t1 use index() where c=1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where @@ -1230,7 +1230,7 @@ qq *a *a*a * explain select * from t1 where v='a'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v,v_2 # 13 const # Using where +1 SIMPLE t1 ref v,v_2 # 13 const # Using index condition select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -1406,7 +1406,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref v v 303 const # Using where; Using index explain select * from t1 where v='a'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # Using where +1 SIMPLE t1 ref v v 303 const # Using index condition select v,count(*) from t1 group by v limit 10; v count(*) a 1 diff --git a/mysql-test/r/myisam_mrr.result b/mysql-test/r/myisam_mrr.result new file mode 100644 index 00000000000..f3f89966da2 --- /dev/null +++ b/mysql-test/r/myisam_mrr.result @@ -0,0 +1,393 @@ +drop table if exists t1, t2, t3; +set @read_rnd_buffer_size_save= @@read_rnd_buffer_size; +set read_rnd_buffer_size=79; +Warnings: +Warning 1292 Truncated incorrect read_rnd_buffer_size value: '79' +select @@read_rnd_buffer_size; +@@read_rnd_buffer_size +8228 +create table t1(a int); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2(a int); +insert into t2 select A.a + 10*(B.a + 10*C.a) from t1 A, t1 B, t1 C; +create table t3 ( +a char(8) not null, b char(8) not null, filler char(200), +key(a) +); +insert into t3 select @a:=concat('c-', 1000+ A.a, '=w'), @a, 'filler' from t2 A; +insert into t3 select concat('c-', 1000+A.a, '=w'), concat('c-', 2000+A.a, '=w'), +'filler-1' from t2 A; +insert into t3 select concat('c-', 1000+A.a, '=w'), concat('c-', 3000+A.a, '=w'), +'filler-2' from t2 A; +select a,filler from t3 where a >= 'c-9011=w'; +a filler +select a,filler from t3 where a >= 'c-1011=w' and a <= 'c-1015=w'; +a filler +c-1011=w filler +c-1012=w filler +c-1013=w filler +c-1014=w filler +c-1015=w filler +c-1011=w filler-1 +c-1012=w filler-1 +c-1013=w filler-1 +c-1014=w filler-1 +c-1015=w filler-1 +c-1011=w filler-2 +c-1012=w filler-2 +c-1013=w filler-2 +c-1014=w filler-2 +c-1015=w filler-2 +select a,filler from t3 where (a>='c-1011=w' and a <= 'c-1013=w') or +(a>='c-1014=w' and a <= 'c-1015=w'); +a filler +c-1011=w filler +c-1012=w filler +c-1013=w filler +c-1014=w filler +c-1015=w filler +c-1011=w filler-1 +c-1012=w filler-1 +c-1013=w filler-1 +c-1014=w filler-1 +c-1015=w filler-1 +c-1011=w filler-2 +c-1012=w filler-2 +c-1013=w filler-2 +c-1014=w filler-2 +c-1015=w filler-2 +insert into t3 values ('c-1013=z', 'c-1013=z', 'err'); +insert into t3 values ('a-1014=w', 'a-1014=w', 'err'); +select a,filler from t3 where (a>='c-1011=w' and a <= 'c-1013=w') or +(a>='c-1014=w' and a <= 'c-1015=w'); +a filler +c-1011=w filler +c-1012=w filler +c-1013=w filler +c-1014=w filler +c-1015=w filler +c-1011=w filler-1 +c-1012=w filler-1 +c-1013=w filler-1 +c-1014=w filler-1 +c-1015=w filler-1 +c-1011=w filler-2 +c-1012=w filler-2 +c-1013=w filler-2 +c-1014=w filler-2 +c-1015=w filler-2 +delete from t3 where b in ('c-1013=z', 'a-1014=w'); +select a,filler from t3 where a='c-1011=w' or a='c-1012=w' or a='c-1013=w' or +a='c-1014=w' or a='c-1015=w'; +a filler +c-1011=w filler +c-1012=w filler +c-1013=w filler +c-1014=w filler +c-1015=w filler +c-1011=w filler-1 +c-1012=w filler-1 +c-1013=w filler-1 +c-1014=w filler-1 +c-1015=w filler-1 +c-1011=w filler-2 +c-1012=w filler-2 +c-1013=w filler-2 +c-1014=w filler-2 +c-1015=w filler-2 +insert into t3 values ('c-1013=w', 'del-me', 'inserted'); +select a,filler from t3 where a='c-1011=w' or a='c-1012=w' or a='c-1013=w' or +a='c-1014=w' or a='c-1015=w'; +a filler +c-1011=w filler +c-1012=w filler +c-1013=w filler +c-1014=w filler +c-1015=w filler +c-1011=w filler-1 +c-1012=w filler-1 +c-1013=w filler-1 +c-1014=w filler-1 +c-1015=w filler-1 +c-1011=w filler-2 +c-1012=w filler-2 +c-1013=w filler-2 +c-1014=w filler-2 +c-1015=w filler-2 +c-1013=w inserted +delete from t3 where b='del-me'; +alter table t3 add primary key(b); +select b,filler from t3 where (b>='c-1011=w' and b<= 'c-1018=w') or +b IN ('c-1019=w', 'c-1020=w', 'c-1021=w', +'c-1022=w', 'c-1023=w', 'c-1024=w'); +b filler +c-1011=w filler +c-1012=w filler +c-1013=w filler +c-1014=w filler +c-1015=w filler +c-1016=w filler +c-1017=w filler +c-1018=w filler +c-1019=w filler +c-1020=w filler +c-1021=w filler +c-1022=w filler +c-1023=w filler +c-1024=w filler +select b,filler from t3 where (b>='c-1011=w' and b<= 'c-1020=w') or +b IN ('c-1021=w', 'c-1022=w', 'c-1023=w'); +b filler +c-1011=w filler +c-1012=w filler +c-1013=w filler +c-1014=w filler +c-1015=w filler +c-1016=w filler +c-1017=w filler +c-1018=w filler +c-1019=w filler +c-1020=w filler +c-1021=w filler +c-1022=w filler +c-1023=w filler +select b,filler from t3 where (b>='c-1011=w' and b<= 'c-1018=w') or +b IN ('c-1019=w', 'c-1020=w') or +(b>='c-1021=w' and b<= 'c-1023=w'); +b filler +c-1011=w filler +c-1012=w filler +c-1013=w filler +c-1014=w filler +c-1015=w filler +c-1016=w filler +c-1017=w filler +c-1018=w filler +c-1019=w filler +c-1020=w filler +c-1021=w filler +c-1022=w filler +c-1023=w filler +create table t4 (a varchar(10), b int, c char(10), filler char(200), +key idx1 (a, b, c)); +insert into t4 (filler) select concat('NULL-', 15-a) from t2 order by a limit 15; +insert into t4 (a,b,c,filler) +select 'b-1',NULL,'c-1', concat('NULL-', 15-a) from t2 order by a limit 15; +insert into t4 (a,b,c,filler) +select 'b-1',NULL,'c-222', concat('NULL-', 15-a) from t2 order by a limit 15; +insert into t4 (a,b,c,filler) +select 'bb-1',NULL,'cc-2', concat('NULL-', 15-a) from t2 order by a limit 15; +insert into t4 (a,b,c,filler) +select 'zz-1',NULL,'cc-2', 'filler-data' from t2 order by a limit 500; +explain +select * from t4 where a IS NULL and b IS NULL and (c IS NULL or c='no-such-row1' + or c='no-such-row2'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t4 range idx1 idx1 29 NULL 10 Using index condition; Using MRR +select * from t4 where a IS NULL and b IS NULL and (c IS NULL or c='no-such-row1' + or c='no-such-row2'); +a b c filler +NULL NULL NULL NULL-15 +NULL NULL NULL NULL-14 +NULL NULL NULL NULL-13 +NULL NULL NULL NULL-12 +NULL NULL NULL NULL-11 +NULL NULL NULL NULL-10 +NULL NULL NULL NULL-9 +NULL NULL NULL NULL-8 +NULL NULL NULL NULL-7 +NULL NULL NULL NULL-6 +NULL NULL NULL NULL-5 +NULL NULL NULL NULL-4 +NULL NULL NULL NULL-3 +NULL NULL NULL NULL-2 +NULL NULL NULL NULL-1 +explain +select * from t4 where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t4 range idx1 idx1 29 NULL 21 Using index condition; Using MRR +select * from t4 where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2'); +a b c filler +b-1 NULL c-1 NULL-15 +b-1 NULL c-1 NULL-14 +b-1 NULL c-1 NULL-13 +b-1 NULL c-1 NULL-12 +b-1 NULL c-1 NULL-11 +b-1 NULL c-1 NULL-10 +b-1 NULL c-1 NULL-9 +b-1 NULL c-1 NULL-8 +b-1 NULL c-1 NULL-7 +b-1 NULL c-1 NULL-6 +b-1 NULL c-1 NULL-5 +b-1 NULL c-1 NULL-4 +b-1 NULL c-1 NULL-3 +b-1 NULL c-1 NULL-2 +b-1 NULL c-1 NULL-1 +bb-1 NULL cc-2 NULL-15 +bb-1 NULL cc-2 NULL-14 +bb-1 NULL cc-2 NULL-13 +bb-1 NULL cc-2 NULL-12 +bb-1 NULL cc-2 NULL-11 +bb-1 NULL cc-2 NULL-10 +bb-1 NULL cc-2 NULL-9 +bb-1 NULL cc-2 NULL-8 +bb-1 NULL cc-2 NULL-7 +bb-1 NULL cc-2 NULL-6 +bb-1 NULL cc-2 NULL-5 +bb-1 NULL cc-2 NULL-4 +bb-1 NULL cc-2 NULL-3 +bb-1 NULL cc-2 NULL-2 +bb-1 NULL cc-2 NULL-1 +select * from t4 ignore index(idx1) where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2'); +a b c filler +b-1 NULL c-1 NULL-15 +b-1 NULL c-1 NULL-14 +b-1 NULL c-1 NULL-13 +b-1 NULL c-1 NULL-12 +b-1 NULL c-1 NULL-11 +b-1 NULL c-1 NULL-10 +b-1 NULL c-1 NULL-9 +b-1 NULL c-1 NULL-8 +b-1 NULL c-1 NULL-7 +b-1 NULL c-1 NULL-6 +b-1 NULL c-1 NULL-5 +b-1 NULL c-1 NULL-4 +b-1 NULL c-1 NULL-3 +b-1 NULL c-1 NULL-2 +b-1 NULL c-1 NULL-1 +bb-1 NULL cc-2 NULL-15 +bb-1 NULL cc-2 NULL-14 +bb-1 NULL cc-2 NULL-13 +bb-1 NULL cc-2 NULL-12 +bb-1 NULL cc-2 NULL-11 +bb-1 NULL cc-2 NULL-10 +bb-1 NULL cc-2 NULL-9 +bb-1 NULL cc-2 NULL-8 +bb-1 NULL cc-2 NULL-7 +bb-1 NULL cc-2 NULL-6 +bb-1 NULL cc-2 NULL-5 +bb-1 NULL cc-2 NULL-4 +bb-1 NULL cc-2 NULL-3 +bb-1 NULL cc-2 NULL-2 +bb-1 NULL cc-2 NULL-1 +drop table t1, t2, t3, t4; +create table t1 (a int, b int not null,unique key (a,b),index(b)); +insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6); +create table t2 like t1; +insert into t2 select * from t1; +alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10)); +select * from t1 where a is null; +a b c +NULL 7 0 +NULL 9 0 +NULL 9 0 +select * from t1 where (a is null or a > 0 and a < 3) and b > 7 limit 3; +a b c +NULL 9 0 +NULL 9 0 +select * from t1 where a is null and b=9 or a is null and b=7 limit 3; +a b c +NULL 7 0 +NULL 9 0 +NULL 9 0 +drop table t1, t2; +set @@read_rnd_buffer_size= @read_rnd_buffer_size_save; +CREATE TABLE t1 ( +ID int(10) unsigned NOT NULL AUTO_INCREMENT, +col1 int(10) unsigned DEFAULT NULL, +key1 int(10) unsigned NOT NULL DEFAULT '0', +key2 int(10) unsigned DEFAULT NULL, +text1 text, +text2 text, +col2 smallint(6) DEFAULT '100', +col3 enum('headers','bodyandsubject') NOT NULL DEFAULT 'bodyandsubject', +col4 tinyint(3) unsigned NOT NULL DEFAULT '0', +PRIMARY KEY (ID), +KEY (key1), +KEY (key2) +) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; +INSERT INTO t1 VALUES +(1,NULL,1130,NULL,'Hello',NULL,100,'bodyandsubject',0), +(2,NULL,1130,NULL,'bye',NULL,100,'bodyandsubject',0), +(3,NULL,1130,NULL,'red',NULL,100,'bodyandsubject',0), +(4,NULL,1130,NULL,'yellow',NULL,100,'bodyandsubject',0), +(5,NULL,1130,NULL,'blue',NULL,100,'bodyandsubject',0); +select * FROM t1 WHERE key1=1130 AND col1 IS NULL ORDER BY text1; +ID col1 key1 key2 text1 text2 col2 col3 col4 +5 NULL 1130 NULL blue NULL 100 bodyandsubject 0 +2 NULL 1130 NULL bye NULL 100 bodyandsubject 0 +1 NULL 1130 NULL Hello NULL 100 bodyandsubject 0 +3 NULL 1130 NULL red NULL 100 bodyandsubject 0 +4 NULL 1130 NULL yellow NULL 100 bodyandsubject 0 +drop table t1; + +BUG#37851: Crash in test_if_skip_sort_order tab->select is zero + +CREATE TABLE t1 ( +pk int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (pk) +); +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 ( +pk int(11) NOT NULL AUTO_INCREMENT, +int_key int(11) DEFAULT NULL, +PRIMARY KEY (pk), +KEY int_key (int_key) +); +INSERT INTO t2 VALUES (1,1),(2,6),(3,0); +EXPLAIN EXTENDED +SELECT MIN(t1.pk) +FROM t1 WHERE EXISTS ( +SELECT t2.pk +FROM t2 +WHERE t2.int_key IS NULL +GROUP BY t2.pk +); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t2 ALL int_key int_key 5 3 33.33 Using index condition; Using filesort +Warnings: +Note 1003 select min(`test`.`t1`.`pk`) AS `MIN(t1.pk)` from `test`.`t1` where 0 +DROP TABLE t1, t2; +# +# BUG#42048 Discrepancy between MyISAM and Maria's ICP implementation +# +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (a int, b char(20), filler char(200), key(a,b(10))); +insert into t1 select A.a + 10*(B.a + 10*C.a), 'bbb','filler' from t0 A, t0 B, t0 C; +update t1 set b=repeat(char(65+a), 20) where a < 25; +This must show range + using index condition: +explain select * from t1 where a < 10 and b = repeat(char(65+a), 20); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 5 NULL 19 Using where +select * from t1 where a < 10 and b = repeat(char(65+a), 20); +a b filler +0 AAAAAAAAAAAAAAAAAAAA filler +1 BBBBBBBBBBBBBBBBBBBB filler +2 CCCCCCCCCCCCCCCCCCCC filler +3 DDDDDDDDDDDDDDDDDDDD filler +4 EEEEEEEEEEEEEEEEEEEE filler +5 FFFFFFFFFFFFFFFFFFFF filler +6 GGGGGGGGGGGGGGGGGGGG filler +7 HHHHHHHHHHHHHHHHHHHH filler +8 IIIIIIIIIIIIIIIIIIII filler +9 JJJJJJJJJJJJJJJJJJJJ filler +drop table t0,t1; +# +# BUG#41136: ORDER BY + range access: EXPLAIN shows "Using MRR" while MRR is actually not used +# +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (a int, b int, key(a)); +insert into t1 select A.a + 10 *(B.a + 10*C.a), A.a + 10 *(B.a + 10*C.a) from t0 A, t0 B, t0 C; +This mustn't show "Using MRR": +explain select * from t1 where a < 20 order by a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 5 NULL 20 Using index condition +drop table t0, t1; diff --git a/mysql-test/r/negation_elimination.result b/mysql-test/r/negation_elimination.result index 91a4c273832..dea0d865d87 100644 --- a/mysql-test/r/negation_elimination.result +++ b/mysql-test/r/negation_elimination.result @@ -79,7 +79,7 @@ a 19 explain select * from t1 where not(a != 10); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 1 Using where; Using index +1 SIMPLE t1 ref a a 5 const 1 Using index select * from t1 where not(a != 1); a 1 diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result index 1cdc48e6552..897366787f1 100644 --- a/mysql-test/r/null.result +++ b/mysql-test/r/null.result @@ -148,10 +148,10 @@ insert into t1 values (7,7), (8,8), (9,9), (10,10), (11,11), (12,12); explain select * from t1 where a between 2 and 3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 4 NULL 2 Using where +1 SIMPLE t1 range idx idx 4 NULL 2 Using index condition; Using MRR explain select * from t1 where a between 2 and 3 or b is null; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 4 NULL 2 Using where +1 SIMPLE t1 range idx idx 4 NULL 2 Using index condition; Using MRR drop table t1; select cast(NULL as signed); cast(NULL as signed) @@ -170,7 +170,7 @@ insert into t1 select i*2 from t1; insert into t1 values(null); explain select * from t1 where i=2 or i is null; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null i i 5 const 9 Using where; Using index +1 SIMPLE t1 ref_or_null i i 5 const 9 Using index select count(*) from t1 where i=2 or i is null; count(*) 10 diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result index 58c587fe588..d59383f3037 100644 --- a/mysql-test/r/null_key.result +++ b/mysql-test/r/null_key.result @@ -21,10 +21,10 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range a,b a 9 NULL 3 Using where; Using index explain select * from t1 where (a is null or a = 7) and b=7; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null a,b a 9 const,const 2 Using where; Using index +1 SIMPLE t1 ref_or_null a,b a 9 const,const 2 Using index explain select * from t1 where (a is null or a = 7) and b=7 order by a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null a,b a 9 const,const 2 Using where; Using index; Using filesort +1 SIMPLE t1 ref_or_null a,b a 9 const,const 2 Using index; Using filesort explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref a,b a 5 const 3 Using where; Using index @@ -151,7 +151,7 @@ alter table t1 modify b int null; insert into t1 values (7,null), (8,null), (8,7); explain select * from t1 where a = 7 and (b=7 or b is null); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null a,b a 10 const,const 2 Using where; Using index +1 SIMPLE t1 ref_or_null a,b a 10 const,const 2 Using index select * from t1 where a = 7 and (b=7 or b is null); a b 7 7 @@ -166,7 +166,7 @@ a b NULL 7 explain select * from t1 where (a = 7 or a is null) and (a = 7 or a is null); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null a a 5 const 5 Using where; Using index +1 SIMPLE t1 ref_or_null a a 5 const 5 Using index select * from t1 where (a = 7 or a is null) and (a = 7 or a is null); a b 7 NULL @@ -192,7 +192,7 @@ a a b explain select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 -1 SIMPLE t1 ref_or_null a a 10 test.t2.a,const 4 Using where; Using index +1 SIMPLE t1 ref_or_null a a 10 test.t2.a,const 4 Using index select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null); a a b 7 7 7 @@ -202,7 +202,7 @@ a a b explain select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 -1 SIMPLE t1 ref_or_null a a 10 test.t2.a,const 4 Using where; Using index +1 SIMPLE t1 ref_or_null a a 10 test.t2.a,const 4 Using index select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7; a a b 7 7 7 @@ -226,7 +226,7 @@ delete from t1 where a=8; explain select * from t2,t1 where t1.a=t2.a or t1.a is null; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 4 -1 SIMPLE t1 ref_or_null a a 5 test.t2.a 4 Using where; Using index +1 SIMPLE t1 ref_or_null a a 5 test.t2.a 4 Using index explain select * from t2,t1 where t1.a<=>t2.a or (t1.a is null and t1.b <> 9); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 4 @@ -258,7 +258,7 @@ INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4 INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL); explain select id from t1 where uniq_id is null; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx1 idx1 5 const 5 Using where +1 SIMPLE t1 ref idx1 idx1 5 const 5 Using index condition explain select id from t1 where uniq_id =1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 const idx1 idx1 5 const 1 diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 306fce1f3c2..334f1547276 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -514,7 +514,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.skr = t3.uid order by t1.gid,t3.skr; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t1.skr 1 Using where +1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t1.skr 1 Using index condition drop table t1,t2,t3; CREATE TABLE t1 ( `titre` char(80) NOT NULL default '', @@ -609,7 +609,7 @@ FieldKey LongVal StringVal 1 2 1 EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range FieldKey,LongField,StringField FieldKey 38 NULL 4 Using where; Using filesort +1 SIMPLE t1 range FieldKey,LongField,StringField FieldKey 38 NULL 4 Using index condition; Using where; Using MRR; Using filesort SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal; FieldKey LongVal StringVal 3 1 2 @@ -638,7 +638,7 @@ create table t1(a int, b int, index(b)); insert into t1 values (2, 1), (1, 1), (4, NULL), (3, NULL), (6, 2), (5, 2); explain select * from t1 where b=1 or b is null order by a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null b b 5 const 3 Using where; Using filesort +1 SIMPLE t1 ref_or_null b b 5 const 3 Using filesort select * from t1 where b=1 or b is null order by a; a b 1 1 @@ -647,7 +647,7 @@ a b 4 NULL explain select * from t1 where b=2 or b is null order by a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null b b 5 const 4 Using where; Using filesort +1 SIMPLE t1 ref_or_null b b 5 const 4 Using filesort select * from t1 where b=2 or b is null order by a; a b 3 NULL @@ -1004,7 +1004,7 @@ t1 LEFT JOIN t1 t2 ON (t1.a = t2.a AND t2.a = 2) ORDER BY c; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort -1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using where SELECT t2.b as c FROM t1 LEFT JOIN t1 t2 ON (t1.a = t2.a AND t2.a = 2) ORDER BY c; @@ -1107,7 +1107,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 index k2 k3 5 NULL 73 Using where EXPLAIN SELECT id,c3 FROM t2 WHERE c2 BETWEEN 20 AND 30 ORDER BY c3 LIMIT 4000; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range k2 k2 5 NULL 386 Using where; Using filesort +1 SIMPLE t2 range k2 k2 5 NULL 386 Using index condition; Using where; Using MRR; Using filesort SELECT id,c3 FROM t2 WHERE c2=11 ORDER BY c3 LIMIT 20; id c3 6 14 @@ -1454,8 +1454,8 @@ SELECT d FROM t1, t2 WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE' ORDER BY t2.c LIMIT 1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a,b b 4 const 4 Using where; Using temporary; Using filesort -1 SIMPLE t2 ref a,b,c a 40 test.t1.a,const 11 Using where +1 SIMPLE t1 ref a,b b 4 const 4 Using index condition; Using temporary; Using filesort +1 SIMPLE t2 ref a,b,c a 40 test.t1.a,const 11 Using index condition SELECT d FROM t1, t2 WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE' ORDER BY t2.c LIMIT 1; diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result index 769d499fc0a..03859954dd1 100644 --- a/mysql-test/r/partition_pruning.result +++ b/mysql-test/r/partition_pruning.result @@ -137,7 +137,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL ref a a 4 const 1 Using where; Using index +1 SIMPLE t1 pNULL ref a a 4 const 1 Using index # Disabling warnings for the invalid date EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra @@ -466,7 +466,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL ref a a 4 const 1 Using where; Using index +1 SIMPLE t1 pNULL ref a a 4 const 1 Using index # Disabling warnings for the invalid date EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra @@ -1820,15 +1820,15 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3 ALL NULL NULL NULL NULL 910 Using where explain partitions select * from t2 where b = 4; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 76 Using where +1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 76 explain extended select * from t2 where b = 6; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ref b b 5 const 76 100.00 Using where +1 SIMPLE t2 ref b b 5 const 76 100.00 Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = 6) explain partitions select * from t2 where b = 6; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 76 Using where +1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 76 explain extended select * from t2 where b in (1,3,5); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL b NULL NULL NULL 910 40.66 Using where diff --git a/mysql-test/r/pool_of_threads.result b/mysql-test/r/pool_of_threads.result index 42460a8040c..0577abaf4ae 100644 --- a/mysql-test/r/pool_of_threads.result +++ b/mysql-test/r/pool_of_threads.result @@ -183,37 +183,37 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range fld1 fld1 4 NULL 4 Using where; Using index select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%'; fld1 fld3 -218401 faithful +012001 flanking +013602 foldout +013606 fingerings 018007 fanatic -228311 fated 018017 featherweight -218022 feed -088303 feminine -058004 Fenton -038017 fetched 018054 fetters -208101 fiftieth -238007 filial -013606 fingerings -218008 finishers -038205 firearm -188505 fitting -202301 Fitzpatrick -238008 fixedly -012001 flanking 018103 flint 018104 flopping +036002 funereal +038017 fetched +038205 firearm +058004 Fenton +088303 feminine +186002 freakish 188007 flurried -013602 foldout +188505 fitting +198006 furthermore +202301 Fitzpatrick +208101 fiftieth +208113 freest +218008 finishers +218022 feed +218401 faithful 226205 foothill -232102 forgivably +226209 furnishings 228306 forthcoming -186002 freakish -208113 freest +228311 fated 231315 freezes -036002 funereal -226209 furnishings -198006 furthermore +232102 forgivably +238007 filial +238008 fixedly select fld3 from t2 where fld3 like "L%" and fld3 = "ok"; fld3 select fld3 from t2 where (fld3 like "C%" and fld3 = "Chantilly"); @@ -1389,15 +1389,15 @@ id select_type table type possible_keys key key_len ref rows Extra explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL NULL NULL NULL NULL 12 @@ -1413,15 +1413,15 @@ id select_type table type possible_keys key key_len ref rows Extra explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0 or companynr > 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; companynr companynr 37 36 diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result index 8d578794d6d..174d7764cf3 100644 --- a/mysql-test/r/ps_1general.result +++ b/mysql-test/r/ps_1general.result @@ -465,9 +465,9 @@ def key 253 64 7 Y 0 31 8 def key_len 253 4096 1 Y 0 31 8 def ref 253 2048 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 -def Extra 253 255 27 N 1 31 8 +def Extra 253 255 48 N 1 31 8 id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using index condition; Using MRR; Using filesort drop table if exists t2; create table t2 (id smallint, name varchar(20)) ; prepare stmt1 from ' insert into t2 values(?, ?) ' ; diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result index ea6494962b6..e8add90ee0f 100644 --- a/mysql-test/r/ps_2myisam.result +++ b/mysql-test/r/ps_2myisam.result @@ -1509,8 +1509,8 @@ prepare stmt1 from 'insert into t1 values(?,?),(?,?)'; execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; select a,b from t1 where a in (@arg00,@arg02) ; a b -81 8-1 82 8-2 +81 8-1 set @arg00=9 ; set @arg01='nine' ; prepare stmt1 from 'insert into t1 set a=?, b=? '; diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index cc5e8d2be96..27f62e180d2 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -220,31 +220,31 @@ insert into t1 (x) values (1),(2),(3),(4),(5),(6),(7),(8),(9); update t1 set y=x; explain select * from t1, t1 t2 where t1.y = 8 and t2.x between 7 and t1.y+0; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref y y 5 const 1 Using where -1 SIMPLE t2 range x x 5 NULL 2 Using where; Using join buffer +1 SIMPLE t1 ref y y 5 const 1 +1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using MRR; Using join buffer explain select * from t1, t1 t2 where t1.y = 8 and t2.x >= 7 and t2.x <= t1.y+0; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref y y 5 const 1 Using where -1 SIMPLE t2 range x x 5 NULL 2 Using where; Using join buffer +1 SIMPLE t1 ref y y 5 const 1 +1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using MRR; Using join buffer explain select * from t1, t1 t2 where t1.y = 2 and t2.x between t1.y-1 and t1.y+1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref y y 5 const 1 Using where -1 SIMPLE t2 range x x 5 NULL 3 Using where; Using join buffer +1 SIMPLE t1 ref y y 5 const 1 +1 SIMPLE t2 range x x 5 NULL 3 Using index condition; Using MRR; Using join buffer explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= t1.y-1 and t2.x <= t1.y+1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref y y 5 const 1 Using where -1 SIMPLE t2 range x x 5 NULL 3 Using where; Using join buffer +1 SIMPLE t1 ref y y 5 const 1 +1 SIMPLE t2 range x x 5 NULL 3 Using index condition; Using MRR; Using join buffer explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref y y 5 const 1 Using where -1 SIMPLE t2 range x x 5 NULL 2 Using where; Using join buffer +1 SIMPLE t1 ref y y 5 const 1 +1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using MRR; Using join buffer explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref y y 5 const 1 Using where -1 SIMPLE t2 range x x 5 NULL 2 Using where; Using join buffer +1 SIMPLE t1 ref y y 5 const 1 +1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using MRR; Using join buffer explain select count(*) from t1 where x in (1); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref x x 5 const 1 Using where; Using index +1 SIMPLE t1 ref x x 5 const 1 Using index explain select count(*) from t1 where x in (1,2); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index x x 5 NULL 9 Using where; Using index @@ -276,7 +276,7 @@ INSERT INTO t1 VALUES (33,5),(33,5),(33,5),(33,5),(34,5),(35,5); EXPLAIN SELECT * FROM t1 WHERE a IN(1,2) AND b=5; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a,b a 5 NULL 2 Using where +1 SIMPLE t1 range a,b a 5 NULL 2 Using index condition; Using where; Using MRR SELECT * FROM t1 WHERE a IN(1,2) AND b=5; a b DROP TABLE t1; @@ -421,19 +421,19 @@ test.t1 analyze status OK test.t2 analyze status Table is already up to date explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range uid_index uid_index 4 NULL 112 Using where +1 SIMPLE t1 range uid_index uid_index 4 NULL 112 Using index condition; Using MRR 1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38 explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range uid_index uid_index 4 NULL 112 Using where +1 SIMPLE t1 range uid_index uid_index 4 NULL 112 Using index condition; Using MRR 1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38 explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range uid_index uid_index 4 NULL 113 Using where +1 SIMPLE t1 range uid_index uid_index 4 NULL 113 Using index condition; Using MRR 1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38 explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range uid_index uid_index 4 NULL 113 Using where +1 SIMPLE t1 range uid_index uid_index 4 NULL 113 Using index condition; Using MRR 1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38 select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0; id name uid id name uid @@ -615,13 +615,13 @@ INSERT INTO t1 (a) VALUES ('111'),('222'),('222'),('222'),('222'),('444'),('aaa'),('AAA'),('bbb'); explain select * from t1 where a='aaa'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 11 const 2 Using where +1 SIMPLE t1 ref a a 11 const 2 Using index condition explain select * from t1 where a=binary 'aaa'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 11 NULL 2 Using where +1 SIMPLE t1 range a a 11 NULL 2 Using index condition; Using MRR explain select * from t1 where a='aaa' collate latin1_bin; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 11 NULL 2 Using where +1 SIMPLE t1 range a a 11 NULL 2 Using index condition; Using MRR explain select * from t1 where a='aaa' collate latin1_german1_ci; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL a NULL NULL NULL 9 Using where @@ -704,7 +704,7 @@ WHERE s.oxrootid = 'd8c4177d09f8b11f5.52725521' AND v.oxrootid ='d8c4177d09f8b11f5.52725521' AND s.oxleft > v.oxleft AND s.oxleft < v.oxright; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE v ref OXLEFT,OXRIGHT,OXROOTID OXROOTID 34 const 5 Using where +1 SIMPLE v ref OXLEFT,OXRIGHT,OXROOTID OXROOTID 34 const 5 Using index condition 1 SIMPLE s ALL OXLEFT NULL NULL NULL 6 Range checked for each record (index map: 0x4) SELECT s.oxid FROM t1 v, t1 s WHERE s.oxrootid = 'd8c4177d09f8b11f5.52725521' AND @@ -878,10 +878,10 @@ INSERT INTO t1 VALUES (55,'C'), (56,'C'), (57,'C'), (58,'C'), (59,'C'), (60,'C'); EXPLAIN SELECT * FROM t1 WHERE status <> 'A' AND status <> 'B'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range status status 23 NULL 11 Using where +1 SIMPLE t1 range status status 23 NULL 11 Using index condition; Using MRR EXPLAIN SELECT * FROM t1 WHERE status NOT IN ('A','B'); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range status status 23 NULL 11 Using where +1 SIMPLE t1 range status status 23 NULL 11 Using index condition; Using MRR SELECT * FROM t1 WHERE status <> 'A' AND status <> 'B'; id status 53 C @@ -910,10 +910,10 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range status status 23 NULL 11 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE status NOT BETWEEN 'A' AND 'B'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range status status 23 NULL 10 Using where +1 SIMPLE t1 range status status 23 NULL 10 Using index condition; Using MRR EXPLAIN SELECT * FROM t1 WHERE status < 'A' OR status > 'B'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range status status 23 NULL 10 Using where +1 SIMPLE t1 range status status 23 NULL 10 Using index condition; Using MRR SELECT * FROM t1 WHERE status NOT BETWEEN 'A' AND 'B'; id status 53 C @@ -1014,20 +1014,20 @@ create table t2 (a varchar(10), filler char(200), key(a)); insert into t2 select * from t1; explain select * from t1 where a between 'a' and 'a '; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 13 NULL # Using where +1 SIMPLE t1 range a a 13 NULL # Using index condition; Using MRR explain select * from t1 where a = 'a' or a='a '; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 13 NULL # Using where +1 SIMPLE t1 range a a 13 NULL # Using index condition; Using MRR explain select * from t2 where a between 'a' and 'a '; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref a a 13 const # Using where +1 SIMPLE t2 ref a a 13 const # Using index condition explain select * from t2 where a = 'a' or a='a '; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref a a 13 const # Using where +1 SIMPLE t2 ref a a 13 const # Using index condition update t1 set a='b' where a<>'a'; explain select * from t1 where a not between 'b' and 'b'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 13 NULL # Using where +1 SIMPLE t1 range a a 13 NULL # Using index condition; Using MRR select a, hex(filler) from t1 where a not between 'b' and 'b'; a hex(filler) a 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 @@ -1071,10 +1071,10 @@ id b c 0 3 4 EXPLAIN SELECT * FROM t1 WHERE b<=3 AND 3<=c; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx1,idx2 idx2 4 NULL 3 Using where +1 SIMPLE t1 range idx1,idx2 idx2 4 NULL 3 Using index condition; Using where; Using MRR EXPLAIN SELECT * FROM t1 WHERE 3 BETWEEN b AND c; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx1,idx2 idx2 4 NULL 3 Using where +1 SIMPLE t1 range idx1,idx2 idx2 4 NULL 3 Using where; Using MRR SELECT * FROM t1 WHERE 0 < b OR 0 > c; id b c 0 3 4 @@ -1085,10 +1085,10 @@ id b c 0 3 4 EXPLAIN SELECT * FROM t1 WHERE 0 < b OR 0 > c; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge idx1,idx2 idx1,idx2 4,4 NULL 4 Using sort_union(idx1,idx2); Using where +1 SIMPLE t1 ALL idx1,idx2 NULL NULL NULL 10 Using where EXPLAIN SELECT * FROM t1 WHERE 0 NOT BETWEEN b AND c; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge idx1,idx2 idx1,idx2 4,4 NULL 4 Using sort_union(idx1,idx2); Using where +1 SIMPLE t1 ALL idx1,idx2 NULL NULL NULL 10 Using where DROP TABLE t1; CREATE TABLE t1 ( item char(20) NOT NULL default '', @@ -1103,7 +1103,7 @@ INSERT INTO t1 VALUES ('A2','2005-12-01 08:00:00',1000); EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref PRIMARY PRIMARY 20 const 2 Using where +1 SIMPLE t1 ref PRIMARY PRIMARY 20 const 2 Using index condition Warnings: Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1 Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1 @@ -1151,7 +1151,7 @@ INSERT INTO t1 VALUES This must use range access: explain select * from t1 where dateval >= '2007-01-01 00:00:00' and dateval <= '2007-01-02 23:59:59'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range dateval dateval 4 NULL 2 Using where +1 SIMPLE t1 range dateval dateval 4 NULL 2 Using index condition; Using MRR drop table t1; CREATE TABLE t1 ( a varchar(32), index (a) @@ -1217,5 +1217,5 @@ Z In following EXPLAIN the access method should be ref, #rows~=500 (and not 2) explain select * from t2 where a=1000 and b<11; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref a a 5 const 502 Using where +1 SIMPLE t2 ref a a 5 const 502 Using index condition drop table t1, t2; diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 6b9a6b7c185..5065e540804 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -185,37 +185,37 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range fld1 fld1 4 NULL 4 Using where; Using index select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%'; fld1 fld3 -218401 faithful +012001 flanking +013602 foldout +013606 fingerings 018007 fanatic -228311 fated 018017 featherweight -218022 feed -088303 feminine -058004 Fenton -038017 fetched 018054 fetters -208101 fiftieth -238007 filial -013606 fingerings -218008 finishers -038205 firearm -188505 fitting -202301 Fitzpatrick -238008 fixedly -012001 flanking 018103 flint 018104 flopping +036002 funereal +038017 fetched +038205 firearm +058004 Fenton +088303 feminine +186002 freakish 188007 flurried -013602 foldout +188505 fitting +198006 furthermore +202301 Fitzpatrick +208101 fiftieth +208113 freest +218008 finishers +218022 feed +218401 faithful 226205 foothill -232102 forgivably +226209 furnishings 228306 forthcoming -186002 freakish -208113 freest +228311 fated 231315 freezes -036002 funereal -226209 furnishings -198006 furthermore +232102 forgivably +238007 filial +238008 fixedly select fld3 from t2 where fld3 like "L%" and fld3 = "ok"; fld3 select fld3 from t2 where (fld3 like "C%" and fld3 = "Chantilly"); @@ -1391,15 +1391,15 @@ id select_type table type possible_keys key key_len ref rows Extra explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL NULL NULL NULL NULL 12 @@ -1415,15 +1415,15 @@ id select_type table type possible_keys key key_len ref rows Extra explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0 or companynr > 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; companynr companynr 37 36 @@ -2362,7 +2362,7 @@ insert into t1 values (1,2), (2,2), (3,2), (4,2); insert into t2 values (1,3), (2,3), (3,4), (4,4); explain select * from t1 left join t2 on a=c where d in (4); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref c,d d 5 const 2 Using where +1 SIMPLE t2 ref c,d d 5 const 2 1 SIMPLE t1 ALL a NULL NULL NULL 4 Using where; Using join buffer select * from t1 left join t2 on a=c where d in (4); a b c d @@ -2370,7 +2370,7 @@ a b c d 4 2 4 4 explain select * from t1 left join t2 on a=c where d = 4; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref c,d d 5 const 2 Using where +1 SIMPLE t2 ref c,d d 5 const 2 1 SIMPLE t1 ALL a NULL NULL NULL 4 Using where; Using join buffer select * from t1 left join t2 on a=c where d = 4; a b c d @@ -2397,11 +2397,11 @@ INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five'); EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 -1 SIMPLE t2 ref a a 23 test.t1.a 2 +1 SIMPLE t2 ref a a 23 test.t1.a 2 Using where EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 -1 SIMPLE t2 ref a a 23 test.t1.a 2 +1 SIMPLE t2 ref a a 23 test.t1.a 2 Using where DROP TABLE t1, t2; CREATE TABLE t1 ( city char(30) ); INSERT INTO t1 VALUES ('London'); @@ -2716,7 +2716,7 @@ explain select straight_join DISTINCT t2.a,t2.b, t1.c from t1, t3, t2 where (t1.c=t2.a or (t1.c=t3.a and t2.a=t3.b)) and t1.b=556476786 and t2.b like '%%' order by t2.b limit 0,1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref b,c b 5 const 1 Using where; Using temporary; Using filesort +1 SIMPLE t1 ref b,c b 5 const 1 Using temporary; Using filesort 1 SIMPLE t3 index PRIMARY,a,b PRIMARY 8 NULL 2 Using index; Using join buffer 1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 2 Range checked for each record (index map: 0x1) DROP TABLE t1,t2,t3; @@ -3417,7 +3417,7 @@ SELECT t2.sku, t2.sppr, t2.name, t1.sku, t1.pr FROM t2, t1 WHERE t2.sku=20 AND (t2.sku=t1.sku OR t2.sppr=t1.sku); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using where +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using MRR DROP TABLE t1,t2; CREATE TABLE t1 (i TINYINT UNSIGNED NOT NULL); INSERT t1 SET i = 0; @@ -3453,7 +3453,7 @@ In next EXPLAIN, B.rows must be exactly 10: explain select * from t2 A, t2 B where A.a=5 and A.b=5 and A.C<5 and B.a=5 and B.b=A.e and (B.b =1 or B.b = 3 or B.b=5); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE A range PRIMARY PRIMARY 12 NULL 4 Using where +1 SIMPLE A range PRIMARY PRIMARY 12 NULL 4 Using index condition; Using where; Using MRR 1 SIMPLE B ref PRIMARY PRIMARY 8 const,test.A.e 10 drop table t1, t2; CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX(b)); @@ -3467,13 +3467,13 @@ INSERT INTO t2 VALUES EXPLAIN SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using where -1 SIMPLE t2 ref c c 5 test.t1.a 2 Using where +1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using index condition; Using MRR +1 SIMPLE t2 ref c c 5 test.t1.a 2 EXPLAIN SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using where -1 SIMPLE t2 ref c c 5 test.t1.a 2 Using where +1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using index condition; Using where; Using MRR +1 SIMPLE t2 ref c c 5 test.t1.a 2 DROP TABLE t1, t2; create table t1 ( a int unsigned not null auto_increment primary key, @@ -3533,7 +3533,7 @@ WHERE t1.id=2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 1 SIMPLE t2 const idx1 NULL NULL NULL 1 -1 SIMPLE t3 ref idx1 idx1 5 const 3 Using where +1 SIMPLE t3 ref idx1 idx1 5 const 3 SELECT * FROM t1 LEFT JOIN t2 ON t2.b=t1.a INNER JOIN t3 ON t3.d=t1.id WHERE t1.id=2; id a b c d e @@ -3562,19 +3562,19 @@ EXPLAIN SELECT t2.* FROM t1 JOIN t2 ON t2.fk=t1.pk WHERE t2.fk < 'c' AND t2.pk=t1.fk; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 3 Using where +1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 3 Using index condition; Using MRR 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where EXPLAIN SELECT t2.* FROM t1 JOIN t2 ON t2.fk=t1.pk WHERE t2.fk BETWEEN 'a' AND 'b' AND t2.pk=t1.fk; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 2 Using where +1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using MRR 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where EXPLAIN SELECT t2.* FROM t1 JOIN t2 ON t2.fk=t1.pk WHERE t2.fk IN ('a','b') AND t2.pk=t1.fk; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 2 Using where +1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using MRR 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where DROP TABLE t1,t2; CREATE TABLE t1 (a int, b varchar(20) NOT NULL, PRIMARY KEY(a)); @@ -3608,7 +3608,7 @@ WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND t3.a=t2.a AND t3.c IN ('bb','ee'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 range si si 5 NULL 4 Using where +1 SIMPLE t2 range si si 5 NULL 4 Using index condition; Using MRR 1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where EXPLAIN SELECT t3.a FROM t1,t2,t3 @@ -3616,7 +3616,7 @@ WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND t3.a=t2.a AND t3.c IN ('bb','ee') ; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 range si,ai si 5 NULL 4 Using where +1 SIMPLE t2 range si,ai si 5 NULL 4 Using index condition; Using MRR 1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where EXPLAIN SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3 @@ -3624,7 +3624,7 @@ WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND t3.c IN ('bb','ee'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 range si si 5 NULL 2 Using where +1 SIMPLE t2 range si si 5 NULL 2 Using index condition; Using MRR 1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where EXPLAIN SELECT t3.a FROM t1,t2,t3 @@ -3632,7 +3632,7 @@ WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND t3.c IN ('bb','ee'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 range si,ai si 5 NULL 2 Using where +1 SIMPLE t2 range si,ai si 5 NULL 2 Using index condition; Using MRR 1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where DROP TABLE t1,t2,t3; CREATE TABLE t1 ( f1 int primary key, f2 int, f3 int, f4 int, f5 int, f6 int, checked_out int); @@ -3752,7 +3752,7 @@ AND t1.ts BETWEEN t2.dt1 AND t2.dt2 AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31"; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t1 range ts ts 4 NULL 1 Using where +1 SIMPLE t1 range ts ts 4 NULL 1 Using index condition; Using where; Using MRR Warnings: Warning 1292 Incorrect datetime value: '2999-12-31 00:00:00' for column 'ts' at row 1 SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30 @@ -3854,7 +3854,7 @@ cc 3 7 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 -1 SIMPLE t2 ref name name 6 test.t1.name 2 +1 SIMPLE t2 ref name name 6 test.t1.name 2 Using where SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name; name name n ccc NULL NULL @@ -3928,7 +3928,7 @@ cc 3 7 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 -1 SIMPLE t2 ref name name 6 test.t1.name 2 +1 SIMPLE t2 ref name name 6 test.t1.name 2 Using where SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name; name name n ccc NULL NULL @@ -4376,12 +4376,12 @@ CREATE TABLE t1 (a INT KEY, b INT); INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4); EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND a = b LIMIT 2; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where; Using MRR Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 1)) limit 2 EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND b = a LIMIT 2; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where; Using MRR Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` > 1)) limit 2 DROP TABLE t1; diff --git a/mysql-test/r/select_safe.result b/mysql-test/r/select_safe.result index feac9efcb13..9419f256472 100644 --- a/mysql-test/r/select_safe.result +++ b/mysql-test/r/select_safe.result @@ -67,12 +67,12 @@ insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(nu explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL b NULL NULL NULL 21 -1 SIMPLE t2 ref b b 21 test.t1.b 6 Using where +1 SIMPLE t2 ref b b 21 test.t1.b 6 set MAX_SEEKS_FOR_KEY=1; explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL b NULL NULL NULL 21 -1 SIMPLE t2 ref b b 21 test.t1.b 6 Using where +1 SIMPLE t2 ref b b 21 test.t1.b 6 SET MAX_SEEKS_FOR_KEY=DEFAULT; drop table t1; create table t1 (a int); diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 3ad556b8c30..d00d118abe3 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -6418,19 +6418,19 @@ INSERT INTO t1 VALUES (1), (2), (3), (4), (5); CREATE VIEW v1 AS SELECT c1 FROM t1; EXPLAIN SELECT * FROM t1 WHERE c1=1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index +1 SIMPLE t1 ref c1 c1 5 const 1 Using index EXPLAIN SELECT * FROM t1 WHERE c1=f1(); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index +1 SIMPLE t1 ref c1 c1 5 const 1 Using index EXPLAIN SELECT * FROM v1 WHERE c1=1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index +1 SIMPLE t1 ref c1 c1 5 const 1 Using index EXPLAIN SELECT * FROM v1 WHERE c1=f1(); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index +1 SIMPLE t1 ref c1 c1 5 const 1 Using index EXPLAIN SELECT * FROM t1 WHERE c1=f2(10); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index +1 SIMPLE t1 ref c1 c1 5 const 1 Using index EXPLAIN SELECT * FROM t1 WHERE c1=f2(c1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL c1 5 NULL 5 Using where; Using index diff --git a/mysql-test/r/ssl.result b/mysql-test/r/ssl.result index 9ad515a53a3..ca845e5ed91 100644 --- a/mysql-test/r/ssl.result +++ b/mysql-test/r/ssl.result @@ -186,37 +186,37 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range fld1 fld1 4 NULL 4 Using where; Using index select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%'; fld1 fld3 -218401 faithful +012001 flanking +013602 foldout +013606 fingerings 018007 fanatic -228311 fated 018017 featherweight -218022 feed -088303 feminine -058004 Fenton -038017 fetched 018054 fetters -208101 fiftieth -238007 filial -013606 fingerings -218008 finishers -038205 firearm -188505 fitting -202301 Fitzpatrick -238008 fixedly -012001 flanking 018103 flint 018104 flopping +036002 funereal +038017 fetched +038205 firearm +058004 Fenton +088303 feminine +186002 freakish 188007 flurried -013602 foldout +188505 fitting +198006 furthermore +202301 Fitzpatrick +208101 fiftieth +208113 freest +218008 finishers +218022 feed +218401 faithful 226205 foothill -232102 forgivably +226209 furnishings 228306 forthcoming -186002 freakish -208113 freest +228311 fated 231315 freezes -036002 funereal -226209 furnishings -198006 furthermore +232102 forgivably +238007 filial +238008 fixedly select fld3 from t2 where fld3 like "L%" and fld3 = "ok"; fld3 select fld3 from t2 where (fld3 like "C%" and fld3 = "Chantilly"); @@ -1392,15 +1392,15 @@ id select_type table type possible_keys key key_len ref rows Extra explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL NULL NULL NULL NULL 12 @@ -1416,15 +1416,15 @@ id select_type table type possible_keys key key_len ref rows Extra explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0 or companynr > 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; companynr companynr 37 36 diff --git a/mysql-test/r/ssl_compress.result b/mysql-test/r/ssl_compress.result index 1bd427a65e2..0dd8d40c8da 100644 --- a/mysql-test/r/ssl_compress.result +++ b/mysql-test/r/ssl_compress.result @@ -189,37 +189,37 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range fld1 fld1 4 NULL 4 Using where; Using index select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%'; fld1 fld3 -218401 faithful +012001 flanking +013602 foldout +013606 fingerings 018007 fanatic -228311 fated 018017 featherweight -218022 feed -088303 feminine -058004 Fenton -038017 fetched 018054 fetters -208101 fiftieth -238007 filial -013606 fingerings -218008 finishers -038205 firearm -188505 fitting -202301 Fitzpatrick -238008 fixedly -012001 flanking 018103 flint 018104 flopping +036002 funereal +038017 fetched +038205 firearm +058004 Fenton +088303 feminine +186002 freakish 188007 flurried -013602 foldout +188505 fitting +198006 furthermore +202301 Fitzpatrick +208101 fiftieth +208113 freest +218008 finishers +218022 feed +218401 faithful 226205 foothill -232102 forgivably +226209 furnishings 228306 forthcoming -186002 freakish -208113 freest +228311 fated 231315 freezes -036002 funereal -226209 furnishings -198006 furthermore +232102 forgivably +238007 filial +238008 fixedly select fld3 from t2 where fld3 like "L%" and fld3 = "ok"; fld3 select fld3 from t2 where (fld3 like "C%" and fld3 = "Chantilly"); @@ -1395,15 +1395,15 @@ id select_type table type possible_keys key key_len ref rows Extra explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL NULL NULL NULL NULL 12 @@ -1419,15 +1419,15 @@ id select_type table type possible_keys key key_len ref rows Extra explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0 or companynr > 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; companynr companynr 37 36 diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index d184ae47df3..8e9ccfcb4eb 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -719,7 +719,7 @@ id 1 EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1); id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ref id id 5 const 1 100.00 Using where; Using index +1 PRIMARY t2 ref id id 5 const 1 100.00 Using index Warnings: Note 1249 Select 2 was reduced during optimization Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = 1) @@ -731,7 +731,7 @@ id 2 EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1)); id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ref id id 5 const 1 100.00 Using where; Using index +1 PRIMARY t2 ref id id 5 const 1 100.00 Using index Warnings: Note 1249 Select 3 was reduced during optimization Note 1249 Select 2 was reduced during optimization @@ -903,7 +903,7 @@ a t1.a in (select t2.a from t2,t3 where t3.a=t2.a) explain extended SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index -2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using index 2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1` @@ -1231,7 +1231,7 @@ create table t1 (id int not null auto_increment primary key, salary int, key(sal insert into t1 (salary) values (100),(1000),(10000),(10),(500),(5000),(50000); explain extended SELECT id FROM t1 where salary = (SELECT MAX(salary) FROM t1); id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where +1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using index condition 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) AS `MAX(salary)` from `test`.`t1`)) @@ -1333,9 +1333,9 @@ a explain extended select * from t2 where t2.a in (select a from t1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where +2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index Warnings: -Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)))) +Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a))) select * from t2 where t2.a in (select a from t1 where t1.b <> 30); a 2 @@ -1353,7 +1353,7 @@ a explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t1 ref a a 5 func 1001 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t1 ref a a 5 func 1001 100.00 Using index 2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 100.00 Using where; Using index; Using join buffer Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)))) @@ -1767,7 +1767,7 @@ explain extended select * from t1 a left join t2 b on (a.id=b.id or b.id is null id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE a ALL NULL NULL NULL NULL 14 100.00 1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00 -1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where +1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition Warnings: Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(((`test`.`b`.`id` = `test`.`a`.`id`) or isnull(`test`.`b`.`id`))) join `test`.`t1` `c` where (if(isnull(`test`.`b`.`id`),1000,`test`.`b`.`id`) = `test`.`c`.`id`) drop table t1,t2; @@ -2949,7 +2949,7 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 1 PRIMARY r const PRIMARY PRIMARY 4 const 1 -2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using where +2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10; @@ -2961,7 +2961,7 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 1 PRIMARY r const PRIMARY PRIMARY 4 const 1 -2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using where +2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10; diff --git a/mysql-test/r/subselect3.result b/mysql-test/r/subselect3.result index a661ec5c78b..ea2c3fc75af 100644 --- a/mysql-test/r/subselect3.result +++ b/mysql-test/r/subselect3.result @@ -724,7 +724,7 @@ WHERE t3.name='xxx' AND t2.id=t3.id); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where 2 DEPENDENT SUBQUERY t2 eq_ref PRIMARY PRIMARY 4 func 1 Using where; Using index; Full scan on NULL key -2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 func 1 Using where; Full scan on NULL key +2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 func 1 Using index condition; Using where; Full scan on NULL key SELECT * FROM t1 WHERE t1.id NOT IN (SELECT t2.id FROM t2,t3 WHERE t3.name='xxx' AND t2.id=t3.id); diff --git a/mysql-test/r/table_elim.result b/mysql-test/r/table_elim.result index 05ec4eed6ba..e546b1a27ed 100644 --- a/mysql-test/r/table_elim.result +++ b/mysql-test/r/table_elim.result @@ -58,7 +58,7 @@ t0 left join (t1 left join (t2 join t3 on t2.b=t3.b) on t2.a=t1.a and t3.a=t1.a) on t0.a=t1.a; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t0 ALL NULL NULL NULL NULL 4 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t0` left join (`test`.`t1`) on((`test`.`t0`.`a` = `test`.`t1`.`a`)) where 1 # Elimination with aggregate functions @@ -128,7 +128,7 @@ Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` where (`f`.`id` in (1,2,3 This should use facts and a1 tables: explain extended select id from v1 where attr1 between 12 and 14; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY a1 range PRIMARY,attr1 attr1 5 NULL 2 100.00 Using where +1 PRIMARY a1 range PRIMARY,attr1 attr1 5 NULL 2 100.00 Using index condition; Using MRR 1 PRIMARY f eq_ref PRIMARY PRIMARY 4 test.a1.id 1 100.00 Using index Warnings: Note 1276 Field or reference 'test.a2.id' of SELECT #3 was resolved in SELECT #1 @@ -136,7 +136,7 @@ Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t1` `a1` whe This should use facts, a2 and its subquery: explain extended select id from v1 where attr2 between 12 and 14; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY a2 range PRIMARY,attr2 attr2 5 NULL 5 100.00 Using where +1 PRIMARY a2 range PRIMARY,attr2 attr2 5 NULL 5 100.00 Using index condition; Using where; Using MRR 1 PRIMARY f eq_ref PRIMARY PRIMARY 4 test.a2.id 1 100.00 Using index 3 DEPENDENT SUBQUERY t2 ref PRIMARY PRIMARY 4 test.a2.id 2 100.00 Using index Warnings: @@ -156,7 +156,7 @@ Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` where (`f`.`id` in (1,2,3 This should use facts and a1 tables: explain extended select id from v2 where attr1 between 12 and 14; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY a1 range PRIMARY,attr1 attr1 5 NULL 2 100.00 Using where +1 PRIMARY a1 range PRIMARY,attr1 attr1 5 NULL 2 100.00 Using index condition; Using MRR 1 PRIMARY f eq_ref PRIMARY PRIMARY 4 test.a1.id 1 100.00 Using index Warnings: Note 1276 Field or reference 'test.f.id' of SELECT #3 was resolved in SELECT #1 @@ -164,7 +164,7 @@ Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t1` `a1` whe This should use facts, a2 and its subquery: explain extended select id from v2 where attr2 between 12 and 14; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY a2 range PRIMARY,attr2 attr2 5 NULL 5 100.00 Using where +1 PRIMARY a2 range PRIMARY,attr2 attr2 5 NULL 5 100.00 Using index condition; Using MRR 1 PRIMARY f eq_ref PRIMARY PRIMARY 4 test.a2.id 1 100.00 Using where; Using index 3 DEPENDENT SUBQUERY t2 ref PRIMARY PRIMARY 4 test.f.id 2 100.00 Using index Warnings: @@ -194,7 +194,7 @@ t2.pk3=t2.pk1+1 and t2.pk2=t2.pk3+t2.col; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a 1 +1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a 1 Using where This must use only t1: explain select t1.* from t1 left join t2 on t2.pk2=t1.a and t2.pk1=t2.pk2+1 and @@ -212,7 +212,7 @@ explain select t1.* from t1 left join ( t2 left join t3 on t3.pk=t2.col) on t2.col=t1.col; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where explain select t1.*, t2.* from t1 left join (t2 left join t3 on t3.pk=t2.col) on t2.pk=t1.col; id select_type table type possible_keys key key_len ref rows Extra @@ -224,7 +224,7 @@ t1 left join ( t2 left join t3 on t3.pk=t2.col or t3.pk=t2.col) on t2.col=t1.col or t2.col=t1.col; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where explain select t1.*, t2.* from t1 left join @@ -247,12 +247,12 @@ this must not use table elimination: explain select t1.* from t1 left join t2 on t2.a='foo' collate latin1_general_ci; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL PRIMARY 10 NULL 2 Using index -1 SIMPLE t2 index PRIMARY PRIMARY 10 NULL 2 Using index +1 SIMPLE t2 index PRIMARY PRIMARY 10 NULL 2 Using where; Using index this must not use table elimination: explain select t1.* from t1 left join t2 on t2.a=t1.a collate latin1_general_ci; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL PRIMARY 10 NULL 2 Using index -1 SIMPLE t2 index PRIMARY PRIMARY 10 NULL 2 Using index +1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 2 Range checked for each record (index map: 0x1) drop table t1,t2; create table t1 (a int primary key); insert into t1 values (1),(2); @@ -262,12 +262,12 @@ this must not use table elimination: explain select t1.* from t1 left join t2 on t2.a=1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index -1 SIMPLE t2 index PRIMARY PRIMARY 10 NULL 2 Using index +1 SIMPLE t2 index PRIMARY PRIMARY 10 NULL 2 Using where; Using index this must not use table elimination: explain select t1.* from t1 left join t2 on t2.a=t1.a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index -1 SIMPLE t2 index PRIMARY PRIMARY 10 NULL 2 Using index +1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 2 Range checked for each record (index map: 0x1) drop table t1, t2; create table t1 (a char(10) primary key); insert into t1 values ('foo'),('bar'); @@ -276,7 +276,7 @@ insert into t2 values ('foo'),('bar'); explain select t1.* from t1 left join t2 on t2.a=t1.a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL PRIMARY 10 NULL 2 Using index -1 SIMPLE t2 ref a a 3 test.t1.a 2 +1 SIMPLE t2 ref a a 3 test.t1.a 2 Using where drop table t1, t2; # # check UPDATE/DELETE that look like they could be eliminated @@ -322,19 +322,19 @@ id select_type table type possible_keys key key_len ref rows Extra explain select t1.a from t1 left join t2 on t2.pk=t1.a or t2.b<t1.b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 2 +1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 2 Using where explain select t1.a from t1 left join t2 on t2.b<t1.b or t2.pk=t1.a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 2 +1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 2 Using where explain select t1.a from t1 left join t2 on t2.pk between 10 and 20; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 index PRIMARY PRIMARY 4 NULL 2 Using index +1 SIMPLE t2 index PRIMARY PRIMARY 4 NULL 2 Using where; Using index explain select t1.a from t1 left join t2 on t2.pk between 0.5 and 1.5; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 index PRIMARY PRIMARY 4 NULL 2 Using index +1 SIMPLE t2 index PRIMARY PRIMARY 4 NULL 2 Using where; Using index explain select t1.a from t1 left join t2 on t2.pk between 10 and 10; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 @@ -388,7 +388,7 @@ on (t2.pk=t2.c and t2.b=t1.a and t2.c=t1.b) or where t1.d=1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 +1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using where explain select t1.* from @@ -405,7 +405,7 @@ select t1.* from t1 left join t2 on t2.pk=3 or t2.pk= 4; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 index PRIMARY PRIMARY 4 NULL 2 Using index +1 SIMPLE t2 index PRIMARY PRIMARY 4 NULL 2 Using where; Using index explain select t1.* from t1 left join t2 on t2.pk=3 or t2.pk= 3; @@ -416,5 +416,5 @@ select t1.* from t1 left join t2 on (t2.pk=3 and t2.b=3) or (t2.pk= 4 and t2.b=3); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 2 Using where +1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 2 Using where; Using MRR drop table t1, t2; diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index d81e80c96f9..72b17d6c324 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -547,7 +547,7 @@ NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL explain (select * from t1 where a=1) union (select * from t1 where b=1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 -2 UNION t1 ref b b 5 const 1 Using where +2 UNION t1 ref b b 5 const 1 NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL drop table t1,t2; create table t1 ( id int not null auto_increment, primary key (id) ,user_name text ); diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 613939bfdf6..2c8e666febb 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -1415,8 +1415,8 @@ a a b explain extended select * from t3 left join v3 on (t3.a = v3.a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`t1` left join `test`.`t2` on((`test`.`t1`.`a` = `test`.`t2`.`a`))) on((`test`.`t3`.`a` = `test`.`t1`.`a`)) where 1 create view v1 (a) as select a from t1; @@ -1430,8 +1430,8 @@ a a b explain extended select * from t3 left join v4 on (t3.a = v4.a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`t1` left join (`test`.`t2`) on((`test`.`t1`.`a` = `test`.`t2`.`a`))) on((`test`.`t3`.`a` = `test`.`t1`.`a`)) where 1 prepare stmt1 from "select * from t3 left join v4 on (t3.a = v4.a);"; @@ -2132,12 +2132,12 @@ INSERT INTO t1 VALUES (2, 'foo2'); INSERT INTO t1 VALUES (1, 'foo1'); SELECT * FROM v1; id f -1 foo1 2 foo2 +1 foo1 SELECT * FROM v1; id f -1 foo1 2 foo2 +1 foo1 DROP VIEW v1; DROP TABLE t1; CREATE TABLE t1 (pk int PRIMARY KEY, b int); @@ -2341,15 +2341,15 @@ CREATE VIEW v1 AS SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a AND t1.b=t2.b; CREATE VIEW v2 AS SELECT t3.* FROM t1,t3 WHERE t1.a=t3.a; EXPLAIN SELECT t1.* FROM t1 JOIN t2 WHERE t1.a=t2.a AND t1.b=t2.b AND t1.a=1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 1 Using where; Using index -1 SIMPLE t2 ref a a 10 const,test.t1.b 2 Using where; Using index +1 SIMPLE t1 ref a a 5 const 1 Using index +1 SIMPLE t2 ref a a 10 const,test.t1.b 2 Using index EXPLAIN SELECT * FROM v1 WHERE a=1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 1 Using where; Using index -1 SIMPLE t2 ref a a 10 const,test.t1.b 2 Using where; Using index +1 SIMPLE t1 ref a a 5 const 1 Using index +1 SIMPLE t2 ref a a 10 const,test.t1.b 2 Using index EXPLAIN SELECT * FROM v2 WHERE a=1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 1 Using where; Using index +1 SIMPLE t1 ref a a 5 const 1 Using index 1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Using join buffer DROP VIEW v1,v2; DROP TABLE t1,t2,t3; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/README.txt b/mysql-test/suite/optimizer_unfixed_bugs/README.txt new file mode 100644 index 00000000000..ddf65555ce2 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/README.txt @@ -0,0 +1,29 @@ +Putting testcases here +~~~~~~~~~~~~~~~~~~~~~~ + +When you work on re-verifying or re-classifying a bug (not fixing it), +it's a good idea to put the mtr-parsable '.test' testcase here. +Benefits: +1) tests downloaded from the bugs db are sometimes close to +mtr-parsable but not completely (for example if they contain +/* comment */); when you re-verify or re-classify you run the test so +may have to make it mtr-parsable; if you then put it in this suite, +the developer who will work on this bug in a few weeks or months will +not have to re-do the same download&fix, she/he can instead reuse your +work. +2) Others can see how their own work influences many unsolved +bugs, by running this suite. If they find that they fix a bug in this +suite, we won't later wonder "how come this bug doesn't happen +anymore, what fixed it?". +3) One can also run this suite with certain switches to see how they +influence unsolved bugs: +./mtr --suite=optimizer_unfixed_bugs \ +--mysqld=--optimizer_switch="firstmatch=off" + +Adding tests to this suite +~~~~~~~~~~~~~~~~~~~~~~~~~~ +One test file per bug, named bugNNNNN.test. +Put the correct (not current and buggy) result file in r/, so that "[ pass ]" +in mtr will mean that a bug looks like fixed. +When you have fixed a bug, remove files from this suite. +t/bug45219.test is an example. diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug36981.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug36981.result new file mode 100644 index 00000000000..1b0a9c636e7 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug36981.result @@ -0,0 +1,9 @@ +set session debug="+d,optimizer_innodb_icp"; +create table `t1` (`c1` char(1) default null,`c2` char(10) default null, +key (`c1`)) +engine=innodb default charset=latin1; +insert into `t1` values ('3',null); +select * from `t1` where `c1`='3' for update; +c1 c2 +3 NULL +drop table `t1`; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug40992.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug40992.result new file mode 100644 index 00000000000..9c30b32e1e5 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug40992.result @@ -0,0 +1,15 @@ +# +# Bug#40992 - InnoDB: Crash when engine_condition_pushdown is on +# +set session debug="+d,optimizer_innodb_icp"; +CREATE TABLE t ( +dummy INT PRIMARY KEY, +a INT UNIQUE, +b int +) ENGINE=InnoDB; +INSERT INTO t VALUES (1,1,1),(3,3,3),(5,5,5); +SELECT * FROM t WHERE a > 2 FOR UPDATE; +dummy a b +3 3 3 +5 5 5 +DROP TABLE t; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41029.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41029.result new file mode 100644 index 00000000000..701d91a0103 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41029.result @@ -0,0 +1,34 @@ +select @default_binlog_format:=@@global.binlog_format; +@default_binlog_format:=@@global.binlog_format +MIXED +set global binlog_format=row; +set session debug="+d,optimizer_innodb_ds_mrr"; +set autocommit=0; +use test; +drop table if exists t1; +Warnings: +Note 1051 Unknown table 't1' +create table t1 (dummy int primary key, a int unique, b int) engine=innodb; +insert into t1 values(1,1,1),(3,3,3),(5,5,5); +commit; +set session transaction isolation level repeatable read; +select @@tx_isolation; +@@tx_isolation +REPEATABLE-READ +start transaction; +select * from t1 where a > 2 for update; +dummy a b +3 3 3 +5 5 5 +use test; +set autocommit=0; +start transaction; +select 1; +1 +1 +insert into t1 values(2,2,2); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +rollback; +rollback; +drop table t1; +set global binlog_format=@default_binlog_format; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra1-innodb-innodb.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra1-innodb-innodb.result new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra1-innodb-innodb.result diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra1-innodb.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra1-innodb.result new file mode 100644 index 00000000000..94b024a9c8f --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra1-innodb.result @@ -0,0 +1,1108 @@ +set optimizer_use_mrr='disable'; +DROP DATABASE IF EXISTS d1; +DROP DATABASE IF EXISTS d2; +DROP DATABASE IF EXISTS d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra1.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra1.result new file mode 100644 index 00000000000..94b024a9c8f --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra1.result @@ -0,0 +1,1108 @@ +set optimizer_use_mrr='disable'; +DROP DATABASE IF EXISTS d1; +DROP DATABASE IF EXISTS d2; +DROP DATABASE IF EXISTS d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra2-innodb-innodb.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra2-innodb-innodb.result new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra2-innodb-innodb.result diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra2-innodb.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra2-innodb.result new file mode 100644 index 00000000000..58654984e33 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra2-innodb.result @@ -0,0 +1,1107 @@ +DROP DATABASE IF EXISTS d1; +DROP DATABASE IF EXISTS d2; +DROP DATABASE IF EXISTS d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra2.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra2.result new file mode 100644 index 00000000000..58654984e33 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra2.result @@ -0,0 +1,1107 @@ +DROP DATABASE IF EXISTS d1; +DROP DATABASE IF EXISTS d2; +DROP DATABASE IF EXISTS d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM d2.t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM d3.t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra3-innodb-innodb.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra3-innodb-innodb.result new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra3-innodb-innodb.result diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra3-innodb.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra3-innodb.result new file mode 100644 index 00000000000..4f9cbfb554c --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra3-innodb.result @@ -0,0 +1,984 @@ +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra3.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra3.result new file mode 100644 index 00000000000..4f9cbfb554c --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra3.result @@ -0,0 +1,984 @@ +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra4-innodb-innodb.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra4-innodb-innodb.result new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra4-innodb-innodb.result diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra4-innodb.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra4-innodb.result new file mode 100644 index 00000000000..0ff634de0f3 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra4-innodb.result @@ -0,0 +1,984 @@ +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra4.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra4.result new file mode 100644 index 00000000000..0ff634de0f3 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra4.result @@ -0,0 +1,984 @@ +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +3 3 +4 4 +5 5 +SELECT * FROM t2 ORDER BY c1; +c1 c2 +12 1 +15 6 +SELECT * FROM t3 ORDER BY c1; +c1 c2 +21 11 +22 11 +23 13 +24 14 +25 15 +DROP TABLE t1,t2,t3; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996.result new file mode 100644 index 00000000000..e42f61376c4 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996.result @@ -0,0 +1,8 @@ +set session debug="+d,optimizer_innodb_icp"; +drop table if exists `t1`; +Warnings: +Note 1051 Unknown table 't1' +create table `t1` (`c` bigint, key(`c`),`a` int)engine=innodb; +insert into `t1` values(2,2); +delete `t1` from `t1` `a`, `t1` where `a`.`a`=`t1`.`c` ; +drop table `t1`; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result new file mode 100644 index 00000000000..0daa91361c2 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result @@ -0,0 +1,252 @@ +set session debug="+d,optimizer_innodb_icp"; +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `table5`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +CREATE TABLE `table5` ( +`col0` mediumtext, +`col1` varchar(90) DEFAULT NULL, +`col2` tinytext, +`col3` time DEFAULT NULL, +`col4` tinyint(1) DEFAULT NULL, +`col5` tinytext, +`col6` tinyint(1) DEFAULT NULL, +`col7` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +`col8` tinyblob, +`col9` tinyint(4) DEFAULT NULL, +`col10` year(4) DEFAULT NULL, +`col11` set('test1','test2','test3') DEFAULT NULL, +`col12` text, +`col13` char(248) DEFAULT NULL, +`col14` bigint(20) DEFAULT NULL, +`col15` text, +`col16` tinyint(4) DEFAULT NULL, +`col17` decimal(10,0) DEFAULT NULL, +`col18` set('test1','test2','test3') DEFAULT NULL, +`col19` varchar(255) DEFAULT NULL, +`col20` float DEFAULT NULL, +`col21` int(11) DEFAULT NULL, +`col22` text, +`col23` tinyint(1) DEFAULT NULL, +`col24` decimal(10,0) NOT NULL DEFAULT '0', +`col25` double DEFAULT NULL, +`col26` float DEFAULT NULL, +`col27` tinyblob, +`col28` decimal(10,0) DEFAULT NULL, +`col29` mediumblob, +`col30` date DEFAULT NULL, +`col31` longtext, +`col32` date DEFAULT NULL, +`col33` float DEFAULT NULL, +`col34` bigint(20) DEFAULT NULL, +`col35` tinytext, +`col36` mediumtext, +`col37` time DEFAULT NULL, +`col38` int(11) DEFAULT NULL, +`col39` tinyint(4) DEFAULT NULL, +`col40` set('test1','test2','test3') DEFAULT NULL, +`col41` char(130) DEFAULT NULL, +`col42` smallint(6) DEFAULT NULL, +`col43` int(11) DEFAULT NULL, +`col44` mediumtext, +`col45` varchar(126) DEFAULT NULL, +`col46` int(11) DEFAULT NULL, +`col47` double DEFAULT NULL, +`col48` bigint(20) DEFAULT NULL, +`col49` mediumtext, +`col50` tinyblob, +`col51` mediumint(9) DEFAULT NULL, +`col52` text, +`col53` varchar(208) DEFAULT NULL, +`col54` varchar(207) DEFAULT NULL, +`col55` decimal(10,0) DEFAULT NULL, +`col56` datetime DEFAULT NULL, +`col57` enum('test1','test2','test3') DEFAULT NULL, +`col58` decimal(10,0) DEFAULT NULL, +`col59` tinyblob, +`col60` varchar(73) DEFAULT NULL, +`col61` mediumtext, +`col62` tinyblob, +`col63` datetime DEFAULT NULL, +`col64` decimal(10,0) DEFAULT NULL, +`col65` mediumint(9) DEFAULT NULL, +`col66` datetime DEFAULT NULL, +`col67` decimal(10,0) DEFAULT NULL, +`col68` tinyint(4) DEFAULT NULL, +`col69` varchar(58) DEFAULT NULL, +`col70` decimal(10,0) DEFAULT NULL, +`col71` mediumtext, +`col72` date DEFAULT NULL, +`col73` time DEFAULT NULL, +`col74` double DEFAULT NULL, +`col75` decimal(10,0) DEFAULT NULL, +`col76` mediumblob, +`col77` double DEFAULT NULL, +`col78` year(4) DEFAULT NULL, +`col79` year(4) DEFAULT NULL, +`col80` varchar(255) DEFAULT NULL, +`col81` blob, +`col82` bigint(20) DEFAULT NULL, +`col83` enum('test1','test2','test3') DEFAULT NULL, +`col84` decimal(10,0) DEFAULT NULL, +`col85` set('test1','test2','test3') DEFAULT NULL, +`col86` mediumtext, +`col87` varchar(255) DEFAULT NULL, +`col88` time DEFAULT NULL, +`col89` enum('test1','test2','test3') DEFAULT NULL, +`col90` decimal(10,0) DEFAULT NULL, +`col91` float DEFAULT NULL, +`col92` datetime DEFAULT NULL, +`col93` tinytext, +`col94` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', +`col95` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', +`col96` text, +`col97` double DEFAULT NULL, +`col98` varchar(198) DEFAULT NULL, +`col99` time DEFAULT NULL, +`col100` tinyint(4) DEFAULT NULL, +`col101` bigint(20) DEFAULT NULL, +`col102` varchar(255) DEFAULT NULL, +`col103` varchar(255) DEFAULT NULL, +`col104` mediumint(9) DEFAULT NULL, +`col105` mediumtext, +`col106` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', +`col107` smallint(6) DEFAULT NULL, +`col108` decimal(10,0) DEFAULT NULL, +`col109` decimal(10,0) DEFAULT NULL, +`col110` float DEFAULT NULL, +`col111` decimal(10,0) DEFAULT NULL, +`col112` double DEFAULT NULL, +`col113` tinytext, +`col114` float DEFAULT NULL, +`col115` varchar(7) DEFAULT NULL, +`col116` longtext, +`col117` date DEFAULT NULL, +`col118` bigint(20) DEFAULT NULL, +`col119` text, +`col120` bigint(20) DEFAULT NULL, +`col121` blob, +`col122` char(110) DEFAULT NULL, +`col123` decimal(10,0) DEFAULT NULL, +`col124` mediumblob, +`col125` decimal(10,0) DEFAULT NULL, +`col126` decimal(10,0) DEFAULT NULL, +`col127` tinyint(1) DEFAULT NULL, +`col128` time DEFAULT NULL, +`col129` tinyblob, +`col130` tinyblob, +`col131` date DEFAULT NULL, +`col132` int(11) DEFAULT NULL, +`col133` varchar(123) DEFAULT NULL, +`col134` char(238) DEFAULT NULL, +`col135` varchar(225) DEFAULT NULL, +`col136` longtext, +`col137` varchar(255) DEFAULT NULL, +`col138` double DEFAULT NULL, +`col139` tinyblob, +`col140` datetime DEFAULT NULL, +`col141` tinytext, +`col142` varchar(255) DEFAULT NULL, +`col143` bigint(20) DEFAULT NULL, +`col144` varchar(236) DEFAULT NULL, +`col145` text, +`col146` year(4) DEFAULT NULL, +`col147` decimal(10,0) DEFAULT NULL, +`col148` text, +`col149` mediumblob, +`col150` tinyint(4) DEFAULT NULL, +`col151` tinyint(1) DEFAULT NULL, +`col152` varchar(72) DEFAULT NULL, +`col153` int(11) DEFAULT NULL, +`col154` varchar(165) DEFAULT NULL, +`col155` tinyint(4) DEFAULT NULL, +`col156` mediumtext, +`col157` double DEFAULT NULL, +`col158` time DEFAULT NULL, +`col159` mediumblob, +`col160` varchar(255) DEFAULT NULL, +`col161` datetime DEFAULT NULL, +`col162` double DEFAULT NULL, +`col163` blob, +`col164` enum('test1','test2','test3') DEFAULT NULL, +`col165` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', +`col166` date DEFAULT NULL, +`col167` tinyblob, +`col168` tinyblob, +`col169` varchar(255) DEFAULT NULL, +`col170` datetime DEFAULT NULL, +`col171` bigint(20) DEFAULT NULL, +`col172` varchar(30) DEFAULT NULL, +`col173` longtext, +`col174` time DEFAULT NULL, +`col175` float DEFAULT NULL, +PRIMARY KEY (`col24`), +KEY `idx0` (`col16`,`col156`(139),`col97`,`col120`), +KEY `idx1` (`col24`,`col0`(108)), +KEY `idx2` (`col117`,`col173`(34),`col132`,`col82`), +KEY `idx3` (`col2`(86)), +KEY `idx4` (`col2`(43)), +KEY `idx5` (`col83`,`col35`(87),`col111`), +KEY `idx6` (`col6`,`col134`,`col92`), +KEY `idx7` (`col56`), +KEY `idx8` (`col30`,`col53`,`col129`(66)), +KEY `idx9` (`col53`,`col113`(211),`col32`,`col15`(75)), +KEY `idx10` (`col34`), +KEY `idx11` (`col126`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; +LOCK TABLES `table5` WRITE; +/*!40000 ALTER TABLE `table5` DISABLE KEYS */; +INSERT INTO `table5` VALUES ('referenda','hermaphroditism','superable','00:00:00',-128,NULL,-128,'0000-00-00 00:00:00',NULL,-128,1901,NULL,'blandly',NULL,6541,'unsuspectingly',NULL,'7250','',NULL,-31358,26248,'Kilmarnock\'s',127,'-27305',28987,NULL,NULL,'-30388','utilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitarians','0000-00-00','Agincourt','0000-00-00',-28063,27242,'readies',NULL,'00:00:00',NULL,-128,'',NULL,NULL,18719,NULL,NULL,14038,17275,NULL,'gait\'s','honeymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'sho',8860,NULL,'demigod','outpulling',NULL,'1904-01-17 09:51:06','test1','-18008','grotesqueness\'sgrotesqueness\'sgrotesqueness\'sgrotesqueness\'sgrotesqueness\'sgrotesqueness\'sgrotesqueness\'s','Oakleil\'s','Shostakovich','indiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscre','2076-10-05 02:05:43','29914',-18885,'2088-05-25 13:36:33','25',-128,'Bob','-14559','ammeter','0000-00-00','00:00:00',-29756,NULL,'digressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigression',-23894,1963,1915,'SadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadye',NULL,NULL,'','17512','','anaphylaxis\'s','chiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schise','50:11:25','test1','-13685',-18328,'2020-01-19 22:04:54',NULL,'1988-05-10 10:30:56','0000-00-00 00:00:00','Birdie\'s',-27746,NULL,'179:19:25',-128,24141,'radiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparen','ingroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'sing',18950,'Beaulieu','0000-00-00 00:00:00',-23421,'-2865',NULL,NULL,NULL,NULL,'vandalizes',-24683,'interop','Apis\'s','0000-00-00',19745,'Volgograd\'s',-15194,NULL,'Binni','4540','phylumphylumphylumphylum','-25781',NULL,-128,'406:37:03','posthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthastepos','manneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristman','0000-00-00',19774,'shariah',NULL,'aquarelle','homographic',NULL,-18959,'thoroughfarethoroughfarethoroughfarethoroughfarethoroughfarethoroughfare','2000-09-05 03:33:50','Baptlsta','Witt\'sWitt\'sWitt\'sWitt\'sWitt\'sWitt\'sWitt\'sWitt\'s',4727,NULL,'posting',2119,'32416',NULL,'charredcharredcharredcharredcharredcharredcharredcharredcharredcharred',-128,NULL,'Rollin\'s',NULL,NULL,127,'waviness\'s',11164,'424:28:18','FaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucher','stalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'s','1901-01-29 13:48:34',-31988,'Dyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'s','','2022-01-01 21:14:30','0000-00-00','conventionalistconventionalistconventionalistconventionalistconventionalistconventionalistconventionalistconventionalist','mirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnesses','tessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stes','2028-05-21 04:56:16',NULL,'Hasid','Hardecanute','00:00:00',-3782); +Warnings: +Warning 1265 Data truncated for column 'col83' at row 1 +Warning 1265 Data truncated for column 'col164' at row 1 +INSERT INTO `table5` VALUES ('hemoglobin\'s','Toffey\'s','Juvenal','00:00:00',-128,'harmonicon',-128,'2004-02-13 09:45:46',NULL,NULL,1911,'','Tananarive\'s',NULL,30666,'spiniferous',127,'30675','','Frederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFr',30388,4769,'Erymanthus\'s',127,'-20972',NULL,-17111,'explosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosiveness','-28154','magnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'s','0000-00-00','removes','0000-00-00',16859,NULL,NULL,'Moishe\'s','00:00:00',NULL,NULL,NULL,'hyperform\'s',30540,-26603,'soporific',NULL,NULL,19264,-14618,NULL,'zootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszo',5654,'intermezzi','Atkins\'s','hieroglyphically','15885','2068-10-19 12:22:30','','4972','apatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapa','severeness','pleaders',NULL,'2070-09-15 17:21:46','15245',-18313,'1934-01-01 01:20:15','-3488',127,'Delawarian','14952','foregathers','0000-00-00','00:00:00',-27837,'7143','madhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'s',-17163,1951,2054,'raffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraf','REMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMs',3607,'','-17633','',NULL,NULL,'806:59:31','test1','-29600',20301,'1985-10-09 17:57:25',NULL,'0000-00-00 00:00:00','0000-00-00 00:00:00','Perseid',-32117,'constructer\'s','612:19:03',127,NULL,'overdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingove','Carlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCa',24868,'preamble','0000-00-00 00:00:00',-7582,'-865','-14488',6884,'-24713',NULL,'topknot\'s',18469,NULL,'histrionism\'s','0000-00-00',31715,'Dag',14543,'wooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'s','tightest',NULL,'aquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'s','15603',NULL,-128,'640:34:17','acetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumaceta','torridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridl','9323-05-13',-28292,'Barnaul\'s',NULL,'slanginesses','supernova',NULL,20804,NULL,'2020-10-05 12:00:38','rive',NULL,-31498,'considerateness\'s','nevus\'s',1901,'-12956','fashioner\'s','unfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'s',-128,127,'nephralgia\'s',13881,'sciatically',NULL,'Tuesday',21227,'00:00:00','halocarbons','duvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduv','2075-01-21 10:49:44',-19735,'snubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubs','test1','0000-00-00 00:00:00','0000-00-00','kiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkib',NULL,'connoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseurscon','1953-01-23 17:36:00',NULL,'Principal',NULL,'316:28:48',NULL); +Warnings: +Warning 1265 Data truncated for column 'col57' at row 1 +Warning 1265 Data truncated for column 'col83' at row 1 +INSERT INTO `table5` VALUES (NULL,'Annmarie','intangibleness\'s','00:00:00',-128,'transmogrify',127,'0000-00-00 00:00:00',NULL,127,2093,'','enamored','refired',-21296,'neglectful',127,'-9992','',NULL,NULL,3583,'Lockheed\'s',127,'-15717',-29743,-16280,'embouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembou','-24875',NULL,'0000-00-00',NULL,'0000-00-00',30124,20356,'drinkable','obscenity','00:00:00',NULL,127,'',NULL,-16664,NULL,'unmoor','Vaughan\'s',30457,-16509,-10049,'squeamishness','encirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencir',-16460,'abatement\'s',NULL,'expatriate','-28670','1925-05-15 11:44:20','','-3762','DelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDel','Skerl\'s','unmatched',NULL,'1980-01-11 16:02:04','25917',18187,'2001-07-26 13:48:08','-28706',127,'gimme','8807',NULL,'0000-00-00','00:00:00',7666,'21762','drawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacks',16131,2031,2077,'subjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysub','Argenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'s',NULL,'','-17090','','fobs','humiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliat','221:02:40','','-1107',4624,'1926-05-11 03:35:52',NULL,'2037-05-13 05:02:44','0000-00-00 00:00:00','Heddie\'s',-6554,NULL,'00:00:00',127,NULL,'lxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlx','RawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawley',6613,'Beaufort','0000-00-00 00:00:00',12214,NULL,'25469',-26474,'12062',NULL,'physiographer',26382,'cosmogo','deportment\'s','0000-00-00',17492,'propretor\'s',NULL,'zingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzing','Suzetta','25513','tearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkers','21613',NULL,-128,'108:58:18','sporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallyspo','Monera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'','0000-00-00',18776,'diffractometer',NULL,'crawls','Inglebert','unguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableun',18112,'melanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanis','1940-05-18 13:21:00','artlessly','blotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblots',6476,NULL,'Bartlett',2143,NULL,'thaumaturge\'s','Hazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'s',127,127,'Winthorpe',-29765,'idiocrasy\'s',NULL,'sandcastles',-9852,'281:41:52','Volny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'s','protagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagon','2076-01-04 15:01:57',NULL,'auscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultations','','0000-00-00 00:00:00','0000-00-00','limenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimen','accommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatingly',NULL,'2018-01-01 05:48:54',17404,NULL,NULL,'195:36:50',24658); +Warnings: +Warning 1265 Data truncated for column 'col57' at row 1 +Warning 1265 Data truncated for column 'col83' at row 1 +Warning 1265 Data truncated for column 'col89' at row 1 +Warning 1265 Data truncated for column 'col164' at row 1 +INSERT INTO `table5` VALUES ('caddishly',NULL,'Kotah','00:00:00',-128,'tailoring',127,'0000-00-00 00:00:00','trustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustie',-128,1967,NULL,NULL,'parallelisms',NULL,NULL,127,NULL,'',NULL,NULL,-513,NULL,NULL,'-14518',NULL,-22393,'AngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAng','32257','regalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregaling','0000-00-00','newspaperwoman','0000-00-00',24845,-17741,'impassiveness','Antillean','00:00:00',-13615,-128,'','gantries',-27983,-6070,'Benetton','aridest',NULL,21574,-25634,'McWilliams\'s','burrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowe',18947,NULL,NULL,'surrealistic',NULL,'1954-07-07 08:58:49','test1','-11714','ExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExEx','administrants','Oxycontin','interpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterper','1914-05-28 05:15:03','3942',NULL,'2046-09-07 18:16:36','3220',127,'arising','18472','anacolutha','0000-00-00','613:15:45',NULL,'-23969',NULL,18979,2031,1975,'AlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcesti','septicitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticities',-25058,'',NULL,'','Kulturkampf','pollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpol','00:00:00','','12283',2881,'1926-12-10 09:24:42','Darken\'s','2034-12-21 15:59:00','0000-00-00 00:00:00',NULL,NULL,NULL,'305:05:06',127,NULL,'feudalityfeudality','Merrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMer',-25733,'borak','0000-00-00 00:00:00',-11465,'877',NULL,-1029,'5107',NULL,'Balaton\'s',NULL,'Martian','miserliness','0000-00-00',14689,'catchment',18457,'billet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'s','humerus\'s','24741',NULL,NULL,'-19233',-128,'00:00:00','fashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfas','judiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjud','0000-00-00',15972,'Letrice\'s','hydrographer',NULL,'Federica','evidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevi',4115,'pshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspsh','1924-10-15 16:31:18','Hamlet','trowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'',-3485,'galvanized',NULL,1924,'-22877','unfired','inchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'s',-128,-128,'VHF',-5304,NULL,127,'glossator',16348,'213:10:59','',NULL,'1946-01-11 17:25:16',262,'DoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDouty','test1','0000-00-00 00:00:00','0000-00-00',NULL,'feasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasibl','contortionisticcontortionisticcontortionisticcontortionisticcontortionisticcontortionisticcontortionistic','2027-06-09 07:56:16',6909,'tessitura','indefensible','00:00:00',-6628); +Warnings: +Warning 1265 Data truncated for column 'col83' at row 1 +Warning 1265 Data truncated for column 'col89' at row 1 +INSERT INTO `table5` VALUES ('bassoonist\'s',NULL,'refastens','114:27:50',127,'unrestricted',127,'2032-01-13 11:11:22','abstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'s',NULL,1955,'','Hodosh','allocates',-5067,'Cenac\'s',-128,'31546',NULL,'impassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassab',-30347,292,'Sandi\'s',NULL,'-12402',8206,NULL,'encircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircl','6346','ArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentinians','0000-00-00','Riehl\'s','0000-00-00',NULL,5580,'planets',NULL,'58:35:07',317,127,'','gender',-19514,7112,'Pissaro','relevantly',28777,-21818,-17111,'shoddiness\'s',NULL,NULL,'flee','Boatwright\'s','restrict','12537','2096-04-25 08:45:21','test1','-4613','quagga','masterstroke\'s','overcheck\'s',NULL,'1981-10-14 18:30:02','21097',-26481,'2065-07-11 02:13:44',NULL,NULL,'bathroom','-29833','gracelessness\'s','0000-00-00','09:44:40',-7368,NULL,'applecart\'sapplecart\'sapplecart\'sapplecart\'sapplecart\'sapplecart\'sapplecart\'sapplecart\'s',-21077,2015,2039,'cascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scas','nervingnervingnervingnervingnervingnervingnervingnervingnervingnerving',22043,'','5740','','mustached','actin\'sactin\'sactin\'sactin\'sactin\'sactin\'sactin\'sactin\'sactin\'sactin\'sactin\'s','00:00:00','test1','13871',-22276,'1956-01-05 15:08:47','slimline','0000-00-00 00:00:00','0000-00-00 00:00:00','royally',NULL,'mako','51:54:53',NULL,NULL,'deliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'s','DOADOADOADOADOADOADOADOADOADOADOADOADOA',-16244,'Fayette\'s','2020-06-21 05:34:18',-24353,'24097','-28819',12278,'-2365',21322,'stumps',-61,NULL,'subpoena\'s','0000-00-00',31242,'knicker',23567,NULL,'Cathar','29557','thallusthallusthallusthallusthallusthallusthallusthallusthallusthallus','26114',NULL,-128,'00:00:00','salmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsal','shiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshive','0000-00-00',-3152,'syndesis','misbrands','Smiga','stagnation\'s','nonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricno',NULL,NULL,'1988-09-11 14:33:03',NULL,'provokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglypr',25510,'thunderpeal\'s','hierology',1932,'7729','Fahrenheit','metathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'s',NULL,-128,'sinfonia\'s',-6293,'proactive',127,NULL,-24751,'00:00:00','woodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopper','Constantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'','1997-01-01 22:40:48',NULL,'MatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlick','test1','2000-12-17 11:19:08','0000-00-00',NULL,'cosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmica','Loesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesc','2078-07-25 04:56:08',10472,NULL,NULL,'345:12:02',-13120); +Warnings: +Warning 1265 Data truncated for column 'col83' at row 1 +INSERT INTO `table5` VALUES ('segmentation\'s','shapelessness\'s','coagulators','127:46:24',-128,NULL,127,'0000-00-00 00:00:00','seekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingsee',NULL,2085,'','indent','flyblown',NULL,'Alegre',-128,'-27917','','DesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDes',2473,NULL,'screwball\'s',NULL,'-4861',-7088,-30734,'tambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintam',NULL,NULL,'0000-00-00','Dorcia','0000-00-00',-25745,-1237,'Shoifet\'s','sarsaparillas','21:11:41',31612,-128,'','subway\'s',-5032,-30369,'preventives','lyre',7995,21283,13197,'chippies','rubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubig',19050,'orch','semiliterates','Gerome',NULL,'2058-12-26 21:29:19','',NULL,'dyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdya','Dukas\'s','Christiania','polyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvale','1920-05-23 14:07:00','672',NULL,'1956-06-27 12:15:00','-22658',NULL,'holograph\'s',NULL,'gutsy','0000-00-00','00:00:00',-9558,'1148','fainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfains',NULL,2023,2132,'Balmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBal','overdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdo',-24707,'test1','-13970','','tensility','BuddieBuddieBuddieBuddieBuddieBuddieBuddieBuddieBuddieBuddie','00:00:00','','580',25115,'2000-07-01 09:01:36','apprentice','1992-01-01 08:55:38','0000-00-00 00:00:00','premunire',24664,NULL,'821:21:05',NULL,-29284,'rapidestrapidestrapidestrapidestrapidestrapidestrapidest','convectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorcon',-3808,'intuitively','0000-00-00 00:00:00',-22296,NULL,'2802',28786,NULL,NULL,'loanword',-12107,'deodori','strophe','0000-00-00',-11013,'undeclared',-8513,'sinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'s','peloria\'s','14940','blushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblush','30550','11566',127,'00:00:00','worktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'swo','looker\'slooker\'slooker\'slooker\'slooker\'slooker\'slooker\'slooker\'slooker\'slooker\'s','5657-05-11',23094,'onerousness','bearer','censured','Shoemaker','mulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomul',5930,'ZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoust','1953-04-28 11:55:44','consulted','invalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinv',-27798,'carnauba\'s','Wilson',1963,NULL,'On\'s','leisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurely',NULL,-128,NULL,17674,'Queenstown\'s',-128,'convertors',1776,'576:20:59',NULL,'allegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriall','2097-10-02 08:41:26',31057,'AfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikaners','test1','0000-00-00 00:00:00','0000-00-00','backwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbac',NULL,NULL,'1932-10-01 18:49:04',12985,NULL,'leukocytes','603:54:26',-22488); +Warnings: +Warning 1265 Data truncated for column 'col57' at row 1 +Warning 1265 Data truncated for column 'col89' at row 1 +INSERT INTO `table5` VALUES ('Frasquito\'s','unsatisfactory','jetted','00:00:00',NULL,'Merlin\'s',127,'0000-00-00 00:00:00',NULL,NULL,1998,'','decomposer','Commons',-14813,'oversimplification\'s',NULL,'-5368','','engirdengirdengirdengirdengirdengirdengirdengirdengird',-13627,14305,'frontally',127,'18421',-32295,NULL,NULL,'21841',NULL,'0000-00-00','cytology','2424-00-17',-30542,-17621,'octarchy\'s','outfoxed','00:00:00',27469,-128,'','Kamat\'s',-24130,-5948,'riband','Betsy',NULL,-18769,NULL,NULL,'Serafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSeraf',NULL,'disconcerting',NULL,'whirly','-20343','2020-07-01 12:09:36','','-26975','antiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticant',NULL,'ecumenically','utilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilize','1952-08-01 17:53:28','7903',-5633,'2024-03-17 13:46:59','-5474',127,'Malmö\'s',NULL,NULL,'0000-00-00','571:58:00',17287,'26711','alphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetize',-15158,2001,1997,'hobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithob','Campinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'s',-5693,'test1','3741','','Audrye\'s','monstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymo','00:00:00','test1','-21023',4693,'1998-01-06 04:41:40','Silastic\'s','0000-00-00 00:00:00','0000-00-00 00:00:00','Hedelman\'s',-30080,'normalization\'s','00:00:00',NULL,8197,NULL,NULL,NULL,'nudism\'s','2005-04-13 00:31:55',29046,'8992','11992',NULL,'-1685',-11453,'mythology\'s',26185,'Pyrenea','Pedrick\'s','0000-00-00',27436,'shots',NULL,'discordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscords','bayonet','-7217','scriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscripts',NULL,'17182',NULL,'628:49:55','nunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenuncle',NULL,'0000-00-00',-17444,'celestite\'s','Adars','Hispaniola','Mesopotamians','agglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutin',31998,'electrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistriesele','2005-09-09 23:41:06','bastinaded',NULL,-10763,'impetuosity\'s','xenogenesis\'s',1947,'-29913',NULL,'taxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomies',NULL,NULL,'internees',28697,'Kharkov\'s',NULL,'Swabia',18366,'00:00:00','delayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayer','circusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycir','2066-02-13 14:27:00',-28405,NULL,'test1','0000-00-00 00:00:00','0000-00-00','heterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotr','enchondromaenchondromaenchondromaenchondromaenchondromaenchondromaenchondromaenchondroma','AryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAry','2090-10-13 10:03:05',NULL,NULL,'Yucatan','285:37:51',7627); +Warnings: +Warning 1265 Data truncated for column 'col57' at row 1 +/*!40000 ALTER TABLE `table5` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +select * from `table5` where (col2 <= '6566-06-15' AND col24 <> 'd') group by `col83` order by `col83` desc ; +col0 col1 col2 col3 col4 col5 col6 col7 col8 col9 col10 col11 col12 col13 col14 col15 col16 col17 col18 col19 col20 col21 col22 col23 col24 col25 col26 col27 col28 col29 col30 col31 col32 col33 col34 col35 col36 col37 col38 col39 col40 col41 col42 col43 col44 col45 col46 col47 col48 col49 col50 col51 col52 col53 col54 col55 col56 col57 col58 col59 col60 col61 col62 col63 col64 col65 col66 col67 col68 col69 col70 col71 col72 col73 col74 col75 col76 col77 col78 col79 col80 col81 col82 col83 col84 col85 col86 col87 col88 col89 col90 col91 col92 col93 col94 col95 col96 col97 col98 col99 col100 col101 col102 col103 col104 col105 col106 col107 col108 col109 col110 col111 col112 col113 col114 col115 col116 col117 col118 col119 col120 col121 col122 col123 col124 col125 col126 col127 col128 col129 col130 col131 col132 col133 col134 col135 col136 col137 col138 col139 col140 col141 col142 col143 col144 col145 col146 col147 col148 col149 col150 col151 col152 col153 col154 col155 col156 col157 col158 col159 col160 col161 col162 col163 col164 col165 col166 col167 col168 col169 col170 col171 col172 col173 col174 col175 +Warnings: +Warning 1366 Incorrect decimal value: 'd' for column 'col24' at row 1 +Warning 1366 Incorrect decimal value: 'd' for column 'col24' at row 1 +drop table `table5`; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43101.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43101.result new file mode 100644 index 00000000000..af0262e1ce6 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43101.result @@ -0,0 +1,31 @@ +CREATE TABLE t1(c1 TIME NOT NULL, c2 TIME NULL, c3 DATE, PRIMARY +KEY(c1), UNIQUE INDEX(c2)); +insert into t1 values('-838:59:59','-838:59:59','2009-01-21'); +insert into t1 values('00:00:00','00:00:00','2009-01-09'); +insert into t1 values('00:00:11','00:00:11','2009-01-20'); +insert into t1 values('00:00:12','00:00:12','2009-01-13'); +insert into t1 values('00:00:45','00:00:45','2009-01-07'); +insert into t1 values('00:11:12','00:11:12','2009-01-19'); +insert into t1 values('00:12:30','00:12:30','2009-01-23'); +insert into t1 values('00:12:34','00:12:34','2009-01-14'); +insert into t1 values('01:23:00','01:23:00','2009-01-03'); +insert into t1 values('08:03:02','08:03:02','2009-01-18'); +insert into t1 values('08:29:45',NULL,'2009-02-01'); +insert into t1 values('09:00:45','09:00:45','2009-01-24'); +insert into t1 values('09:36:00','09:36:00','2009-01-25'); +insert into t1 values('10:00:00','10:00:00','2009-01-06'); +insert into t1 values('10:11:12','10:11:12','2009-01-11'); +insert into t1 values('10:22:33','10:22:33','2009-01-02'); +insert into t1 values('11:11:12','11:11:12','2009-01-12'); +insert into t1 values('11:11:27','11:11:27','2009-01-17'); +insert into t1 values('12:34:56','12:34:56','2009-01-01'); +insert into t1 values('12:34:58','12:34:58','2009-01-15'); +insert into t1 values('12:35:56','12:35:56','2009-01-16'); +insert into t1 values('491:22:33','491:22:33','2009-01-04'); +insert into t1 values('825:23:00','825:23:00','2009-01-05'); +insert into t1 values('838:59:59','838:59:59','2009-01-21'); +SELECT * FROM t1 WHERE c2 <> NULL ORDER BY c2 DESC; +c1 c2 c3 +SELECT * FROM t1 WHERE c2 <> NULL ORDER BY c2 DESC LIMIT 2; +c1 c2 c3 +drop table t1; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43249.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43249.result new file mode 100644 index 00000000000..c60a830b899 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43249.result @@ -0,0 +1,11 @@ +set session debug="+d,optimizer_innodb_icp"; +CREATE TABLE t1(c1 TIME NOT NULL, c2 TIME NULL, c3 DATE, PRIMARY +KEY(c1), UNIQUE INDEX(c2)) engine=innodb; +INSERT INTO t1 VALUES('8:29:45',NULL,'2009-02-01'); +SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c2 LIMIT 2; +c1 c2 c3 +08:29:45 NULL 2009-02-01 +SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c2 LIMIT 2; +c1 c2 c3 +08:29:45 NULL 2009-02-01 +drop table `t1`; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43360.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43360.result new file mode 100644 index 00000000000..a6f4fcd0018 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43360.result @@ -0,0 +1,44 @@ +# +# Bug#43360 - Server crash with a simple multi-table update +# +set session debug="+d,optimizer_innodb_icp"; +CREATE TABLE t1 ( +a CHAR(2) NOT NULL PRIMARY KEY, +b VARCHAR(20) NOT NULL, +KEY (b) +) ENGINE=InnoDB; +CREATE TABLE t2 ( +a CHAR(2) NOT NULL PRIMARY KEY, +b VARCHAR(20) NOT NULL, +KEY (b) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES +('AB','MySQLAB'), +('JA','Sun Microsystems'), +('MS','Microsoft'), +('IB','IBM- Inc.'), +('GO','Google Inc.'); +INSERT INTO t2 VALUES +('AB','Sweden'), +('JA','USA'), +('MS','United States of America'), +('IB','North America'), +('GO','South America'); +Warnings: +Warning 1265 Data truncated for column 'b' at row 3 +UPDATE t1,t2 SET t1.b=UPPER(t1.b) WHERE t1.b LIKE 'United%'; +SELECT * FROM t1; +a b +GO Google Inc. +IB IBM- Inc. +MS Microsoft +AB MySQLAB +JA Sun Microsystems +SELECT * FROM t2; +a b +IB North America +GO South America +AB Sweden +MS United States of Ame +JA USA +DROP TABLE t1,t2; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43448.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43448.result new file mode 100644 index 00000000000..9c9d99837cc --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43448.result @@ -0,0 +1,30 @@ +# +# Bug#43448 - Server crashes on multi table delete with Innodb +# +set session debug="+d,optimizer_innodb_icp"; +CREATE TABLE t1 ( +id1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +t CHAR(12) +) ENGINE=InnoDB; +CREATE TABLE t2 ( +id2 INT NOT NULL, +t CHAR(12) +) ENGINE=InnoDB; +CREATE TABLE t3( +id3 INT NOT NULL, +t CHAR(12), +INDEX(id3) +) ENGINE=InnoDB; +SELECT COUNT(*) FROM t1 WHERE id1 > 90; +COUNT(*) +10 +SELECT COUNT(*) FROM t2 WHERE id2 > 90; +COUNT(*) +50 +SELECT COUNT(*) FROM t3 WHERE id3 > 90; +COUNT(*) +500 +DELETE t1, t2, t3 +FROM t1, t2, t3 +WHERE t1.id1 = t2.id2 AND t2.id2 = t3.id3 AND t1.id1 > 5; +DROP TABLE t1, t2, t3; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result new file mode 100644 index 00000000000..a03306fa69b --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result @@ -0,0 +1,97 @@ +set storage_engine=innodb; +set session debug="+d,optimizer_innodb_icp"; +CREATE TABLE t1(c1 TIMESTAMP NOT NULL, c2 TIMESTAMP NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1), UNIQUE INDEX(c2)); +INSERT INTO t1 VALUES('98-12-31 11:30:45','98.12.31 11+30+45','98-12-31 11:30:45','98.12.31 11+30+45'),('98/12/30 11*30*45','98@12@30 11^30^45','98/12/30 11*30*45','98@12@30 11^30^45'),('98-12-29','98.12.29','98-12-29','98.12.29'),('98/12/28','98@12@28','98/12/28','98@12@28'); +Warnings: +Note 1265 Data truncated for column 'c3' at row 1 +Note 1265 Data truncated for column 'c3' at row 2 +INSERT INTO t1 VALUES('20070523091528','070523091528','20070524091528','070524091528'),('20070525','070525','20070526','070526'); +Warnings: +Note 1265 Data truncated for column 'c3' at row 1 +INSERT INTO t1 VALUES(19830905132800,830905132800,19830906132800,830906132800),(19830907,830907,19830908,830908); +Warnings: +Note 1265 Data truncated for column 'c3' at row 1 +SET TIMESTAMP=1233216687; +INSERT INTO t1 VALUES(NOW(),CURRENT_DATE,NOW(),CURRENT_DATE); +Warnings: +Note 1265 Data truncated for column 'c3' at row 1 +INSERT INTO t1 VALUES('2008-01-01',NULL,'08-01-02','08/01/03'); +INSERT INTO t1(c1,c2) VALUES('08/01/17',NULL); +DELETE FROM t1 WHERE c1='08/01/17' AND c2 IS NULL; +INSERT INTO t1 VALUES('','','08-01-04','08/01/05') /* Inserts zero dates for '' strings */; +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +Warning 1265 Data truncated for column 'c2' at row 1 +SELECT * FROM t1; +c1 c2 c3 c4 +0000-00-00 00:00:00 0000-00-00 00:00:00 2008-01-04 2008-01-05 00:00:00 +1983-09-05 13:28:00 1983-09-05 13:28:00 1983-09-06 1983-09-06 13:28:00 +1983-09-07 00:00:00 1983-09-07 00:00:00 1983-09-08 1983-09-08 00:00:00 +1998-12-28 00:00:00 1998-12-28 00:00:00 1998-12-28 1998-12-28 00:00:00 +1998-12-29 00:00:00 1998-12-29 00:00:00 1998-12-29 1998-12-29 00:00:00 +1998-12-30 11:30:45 1998-12-30 11:30:45 1998-12-30 1998-12-30 11:30:45 +1998-12-31 11:30:45 1998-12-31 11:30:45 1998-12-31 1998-12-31 11:30:45 +2007-05-23 09:15:28 2007-05-23 09:15:28 2007-05-24 2007-05-24 09:15:28 +2007-05-25 00:00:00 2007-05-25 00:00:00 2007-05-26 2007-05-26 00:00:00 +2008-01-01 00:00:00 NULL 2008-01-02 2008-01-03 00:00:00 +2009-01-29 11:11:27 2009-01-29 00:00:00 2009-01-29 2009-01-29 00:00:00 +INSERT IGNORE INTO t1(c1,c2) VALUES('20070525','20070527') /* doesn't throw error */; + +# Ignore unique constraint +INSERT IGNORE INTO t1(c1,c2) VALUES(19840905,830907) /* doesn't throw error */; +SELECT * FROM t1 WHERE c1='20070527' /* Returns no rows */; +c1 c2 c3 c4 +INSERT INTO t1(c1) VALUES('20070525') ON DUPLICATE KEY UPDATE c1='20070527'; +SELECT * FROM t1 WHERE c1='20070527' /* Returns 1 row with c1=2007-05-27 */; +c1 c2 c3 c4 +2007-05-27 00:00:00 2007-05-25 00:00:00 2007-05-26 2007-05-26 00:00:00 +SELECT * FROM t1 WHERE c1=19830909 AND c2=830910 /* Returns no rows */; +c1 c2 c3 c4 +INSERT INTO t1(c1,c2) VALUES(19840905,830907) ON DUPLICATE KEY UPDATE c1=19830909,c2=830910; +SELECT * FROM t1 WHERE c1=19830909 AND c2=830910 /* Returns 1 row */; +c1 c2 c3 c4 +1983-09-09 00:00:00 1983-09-10 00:00:00 1983-09-08 1983-09-08 00:00:00 +INSERT INTO t1 SET c1='1999-01-01',c2='1999-01-01'; +SELECT * FROM t1 WHERE c1='1999-01-01' AND c2='1999-01-01' /* Returns 1 row with values for other column as NULL */; +c1 c2 c3 c4 +1999-01-01 00:00:00 1999-01-01 00:00:00 NULL NULL +INSERT INTO t1 VALUES('1971-01-01 00:00:01','1980-01-01 00:00:01','2009-01-01','2009-01-02'),('1990-01-01 00:00:01','2000-01-01 00:00:01','2009-01-03','2009-01-04'),('2038-01-09 03:14:07','2038-01-09 03:14:07','2009-01-05','2009-01-06'); +DELETE FROM t1 WHERE c1=NOW() /* because the row with current timestamp exists */; +INSERT INTO t1 VALUES(NULL,NOW(),NOW(),NOW()); +Warnings: +Note 1265 Data truncated for column 'c3' at row 1 +SELECT * FROM t1 WHERE c1 IS NULL /* returns no rows */; +c1 c2 c3 c4 +SELECT * FROM t1 WHERE c1=NOW() /* returns 1 row */; +c1 c2 c3 c4 +2009-01-29 11:11:27 2009-01-29 11:11:27 2009-01-29 2009-01-29 11:11:27 +SELECT * FROM t1; +c1 c2 c3 c4 +0000-00-00 00:00:00 0000-00-00 00:00:00 2008-01-04 2008-01-05 00:00:00 +1971-01-01 00:00:01 1980-01-01 00:00:01 2009-01-01 2009-01-02 00:00:00 +1983-09-05 13:28:00 1983-09-05 13:28:00 1983-09-06 1983-09-06 13:28:00 +1983-09-09 00:00:00 1983-09-10 00:00:00 1983-09-08 1983-09-08 00:00:00 +1990-01-01 00:00:01 2000-01-01 00:00:01 2009-01-03 2009-01-04 00:00:00 +1998-12-28 00:00:00 1998-12-28 00:00:00 1998-12-28 1998-12-28 00:00:00 +1998-12-29 00:00:00 1998-12-29 00:00:00 1998-12-29 1998-12-29 00:00:00 +1998-12-30 11:30:45 1998-12-30 11:30:45 1998-12-30 1998-12-30 11:30:45 +1998-12-31 11:30:45 1998-12-31 11:30:45 1998-12-31 1998-12-31 11:30:45 +1999-01-01 00:00:00 1999-01-01 00:00:00 NULL NULL +2007-05-23 09:15:28 2007-05-23 09:15:28 2007-05-24 2007-05-24 09:15:28 +2007-05-27 00:00:00 2007-05-25 00:00:00 2007-05-26 2007-05-26 00:00:00 +2008-01-01 00:00:00 NULL 2008-01-02 2008-01-03 00:00:00 +2009-01-29 11:11:27 2009-01-29 11:11:27 2009-01-29 2009-01-29 11:11:27 +2038-01-09 03:14:07 2038-01-09 03:14:07 2009-01-05 2009-01-06 00:00:00 +SELECT * FROM t1 WHERE c2 IN ('1971-01-01 00:00:01','2038-01-09 03:14:07') ORDER BY c2; +c1 c2 c3 c4 +2038-01-09 03:14:07 2038-01-09 03:14:07 2009-01-05 2009-01-06 00:00:00 +SELECT * FROM t1 WHERE c2 IN ('1971-01-01 00:00:01','2038-01-09 03:14:07') ORDER BY c2 LIMIT 2; +c1 c2 c3 c4 +2038-01-09 03:14:07 2038-01-09 03:14:07 2009-01-05 2009-01-06 00:00:00 +SELECT * FROM t1 WHERE c2 IN ('1971-01-01 00:00:01','2038-01-09 03:14:07') ORDER BY c2 DESC; +c1 c2 c3 c4 +2038-01-09 03:14:07 2038-01-09 03:14:07 2009-01-05 2009-01-06 00:00:00 +SELECT * FROM t1 WHERE c2 IN ('1971-01-01 00:00:01','2038-01-09 03:14:07') ORDER BY c2 DESC LIMIT 2; +c1 c2 c3 c4 +2038-01-09 03:14:07 2038-01-09 03:14:07 2009-01-05 2009-01-06 00:00:00 +DROP TABLE t1; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43618.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43618.result new file mode 100644 index 00000000000..ee5a8bebf4d --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43618.result @@ -0,0 +1,54 @@ +CREATE TABLE t1(c1 TIMESTAMP NOT NULL, c2 TIMESTAMP NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1), UNIQUE INDEX(c2)); +INSERT INTO t1 VALUES('98-12-31 11:30:45','98.12.31 11+30+45','98-12-31 11:30:45','98.12.31 11+30+45'),('98/12/30 11*30*45','98@12@30 11^30^45','98/12/30 11*30*45','98@12@30 11^30^45'),('98-12-29','98.12.29','98-12-29','98.12.29'),('98/12/28','98@12@28','98/12/28','98@12@28'); +Warnings: +Note 1265 Data truncated for column 'c3' at row 1 +Note 1265 Data truncated for column 'c3' at row 2 +INSERT INTO t1 VALUES('20070523091528','070523091528','20070524091528','070524091528'),('20070525','070525','20070526','070526'); +Warnings: +Note 1265 Data truncated for column 'c3' at row 1 +INSERT INTO t1 VALUES(19830905132800,830905132800,19830906132800,830906132800),(19830907,830907,19830908,830908); +Warnings: +Note 1265 Data truncated for column 'c3' at row 1 +SET TIMESTAMP=1233216687; +INSERT INTO t1 VALUES(NOW(),CURRENT_DATE,NOW(),CURRENT_DATE); +Warnings: +Note 1265 Data truncated for column 'c3' at row 1 +INSERT INTO t1 VALUES('2008-01-01',NULL,'08-01-02','08/01/03'); +INSERT INTO t1(c1,c2) VALUES('08/01/17',NULL); +DELETE FROM t1 WHERE c1='08/01/17' AND c2 IS NULL; +INSERT INTO t1 VALUES('','','08-01-04','08/01/05') /* Inserts zero dates for '' strings */; +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +Warning 1265 Data truncated for column 'c2' at row 1 +INSERT INTO t1 VALUES('1971-01-01 00:00:01','1980-01-01 00:00:01','2009-01-01','2009-01-02'),('1990-01-01 00:00:01','2000-01-01 00:00:01','2009-01-03','2009-01-04'),('2038-01-09 03:14:07','2038-01-09 03:14:07','2009-01-05','2009-01-06'); +SELECT * FROM t1; +c1 c2 c3 c4 +0000-00-00 00:00:00 0000-00-00 00:00:00 2008-01-04 2008-01-05 00:00:00 +1971-01-01 00:00:01 1980-01-01 00:00:01 2009-01-01 2009-01-02 00:00:00 +1983-09-05 13:28:00 1983-09-05 13:28:00 1983-09-06 1983-09-06 13:28:00 +1983-09-07 00:00:00 1983-09-07 00:00:00 1983-09-08 1983-09-08 00:00:00 +1990-01-01 00:00:01 2000-01-01 00:00:01 2009-01-03 2009-01-04 00:00:00 +1998-12-28 00:00:00 1998-12-28 00:00:00 1998-12-28 1998-12-28 00:00:00 +1998-12-29 00:00:00 1998-12-29 00:00:00 1998-12-29 1998-12-29 00:00:00 +1998-12-30 11:30:45 1998-12-30 11:30:45 1998-12-30 1998-12-30 11:30:45 +1998-12-31 11:30:45 1998-12-31 11:30:45 1998-12-31 1998-12-31 11:30:45 +2007-05-23 09:15:28 2007-05-23 09:15:28 2007-05-24 2007-05-24 09:15:28 +2007-05-25 00:00:00 2007-05-25 00:00:00 2007-05-26 2007-05-26 00:00:00 +2008-01-01 00:00:00 NULL 2008-01-02 2008-01-03 00:00:00 +2009-01-29 11:11:27 2009-01-29 00:00:00 2009-01-29 2009-01-29 00:00:00 +2038-01-09 03:14:07 2038-01-09 03:14:07 2009-01-05 2009-01-06 00:00:00 +SELECT * FROM t1 WHERE c1 BETWEEN '0000-00-00' AND '2010-00-01 00:00:00' ORDER BY c1 DESC LIMIT 2; +c1 c2 c3 c4 +2009-01-29 11:11:27 2009-01-29 00:00:00 2009-01-29 2009-01-29 00:00:00 +2008-01-01 00:00:00 NULL 2008-01-02 2008-01-03 00:00:00 +Warnings: +Warning 1292 Incorrect datetime value: '2010-00-01 00:00:00' for column 'c1' at row 1 +Warning 1292 Incorrect datetime value: '2010-00-01 00:00:00' for column 'c1' at row 1 +SELECT * FROM t1 WHERE c2 BETWEEN '1971-01-01 00:00:01' AND '2010-10-00 00:00:00' ORDER BY c2 DESC LIMIT 2; +c1 c2 c3 c4 +2009-01-29 11:11:27 2009-01-29 00:00:00 2009-01-29 2009-01-29 00:00:00 +2007-05-25 00:00:00 2007-05-25 00:00:00 2007-05-26 2007-05-26 00:00:00 +Warnings: +Warning 1292 Incorrect datetime value: '2010-10-00 00:00:00' for column 'c2' at row 1 +Warning 1292 Incorrect datetime value: '2010-10-00 00:00:00' for column 'c2' at row 1 +DROP TABLE t1; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug45219.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug45219.result new file mode 100644 index 00000000000..a2d173f5140 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug45219.result @@ -0,0 +1,199 @@ +DROP TABLE IF EXISTS CC, C, BB; +CREATE TABLE `CC` ( +`pk` int(11) NOT NULL AUTO_INCREMENT, +`int_nokey` int(11) NOT NULL, +`datetime_key` datetime NOT NULL, +`varchar_key` varchar(1) NOT NULL, +PRIMARY KEY (`pk`), +KEY `datetime_key` (`datetime_key`), +KEY `varchar_key` (`varchar_key`) +) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1; +INSERT INTO `CC` VALUES +(10,0,'2006-07-07 07:26:28','q'),(11,5,'2002-09-23 00:00:00','m'), +(12,7,'0000-00-00 00:00:00','j'),(13,1,'2006-06-07 00:00:00','z'), +(14,8,'2000-09-16 12:15:34','a'),(15,2,'2007-08-05 15:47:52',''), +(16,1,'0000-00-00 00:00:00','e'),(17,8,'2005-12-02 19:34:26','t'), +(18,5,'0000-00-00 00:00:00','q'),(19,4,'0000-00-00 00:00:00','b'), +(20,5,'2007-12-28 00:00:00','w'),(21,3,'2004-08-02 11:48:43','m'), +(22,0,'0000-00-00 00:00:00','x'),(23,8,'2004-04-19 12:18:43',''), +(24,0,'2009-04-27 00:00:00','w'),(25,4,'2006-10-20 14:52:15','x'), +(26,0,'0000-00-00 00:00:00','e'),(27,0,'2002-03-22 11:48:37','e'), +(28,2,'0000-00-00 00:00:00','p'),(29,0,'2001-01-04 03:55:07','x'); +CREATE TABLE `C` ( +`pk` int(11) NOT NULL AUTO_INCREMENT, +`int_nokey` int(11) NOT NULL, +`datetime_key` datetime NOT NULL, +`varchar_key` varchar(1) NOT NULL, +PRIMARY KEY (`pk`), +KEY `datetime_key` (`datetime_key`), +KEY `varchar_key` (`varchar_key`) +) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1; +INSERT INTO `C` VALUES +(1,9,'0000-00-00 00:00:00','p'),(2,0,'2002-02-09 07:38:13','v'), +(3,8,'2001-05-03 12:08:14','t'),(4,3,'0000-00-00 00:00:00','u'), +(5,7,'2009-07-28 03:43:30','n'),(6,0,'2009-08-04 00:00:00','l'), +(7,1,'0000-00-00 00:00:00','h'),(8,9,'0000-00-00 00:00:00','u'), +(9,0,'2005-08-02 17:16:54','n'),(10,9,'2002-12-21 00:00:00','j'), +(11,0,'2005-08-15 12:37:35','k'),(12,5,'0000-00-00 00:00:00','e'), +(13,0,'2006-03-10 00:00:00','i'),(14,8,'2005-05-16 11:02:36','u'), +(15,8,'2008-11-02 00:00:00','n'),(16,5,'2006-03-15 00:00:00','b'), +(17,1,'0000-00-00 00:00:00','x'),(18,7,'0000-00-00 00:00:00',''), +(19,0,'2008-12-17 20:15:40','q'),(20,9,'0000-00-00 00:00:00','u'); +CREATE TABLE `BB` ( +`pk` int(11) NOT NULL AUTO_INCREMENT, +`int_nokey` int(11) NOT NULL, +`datetime_key` datetime NOT NULL, +`varchar_key` varchar(1) NOT NULL, +PRIMARY KEY (`pk`), +KEY `datetime_key` (`datetime_key`), +KEY `varchar_key` (`varchar_key`) +) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=latin1; +INSERT INTO `BB` VALUES +(10,8,'2007-08-19 08:08:38','i'),(11,0,'2000-05-21 03:51:51',''); +SELECT DISTINCT `datetime_key` +FROM C +WHERE ( `int_nokey` , `pk` ) IN ( +SELECT INNR .`pk` , INNR .`pk` +FROM CC LEFT JOIN BB INNR ON INNR .`varchar_key` ) AND `pk` = 9 ; +datetime_key +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'i' +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect INTEGER value: 'i' +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect INTEGER value: 'i' +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect INTEGER value: 'i' +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect INTEGER value: 'i' +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect INTEGER value: 'i' +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect INTEGER value: 'i' +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect INTEGER value: 'i' +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect INTEGER value: 'i' +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect INTEGER value: 'i' +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect INTEGER value: 'i' +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect INTEGER value: 'i' +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect INTEGER value: 'i' +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect INTEGER value: 'i' +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect INTEGER value: 'i' +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect INTEGER value: 'i' +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect INTEGER value: 'i' +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect INTEGER value: 'i' +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect INTEGER value: 'i' +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect INTEGER value: 'i' +Warning 1292 Truncated incorrect INTEGER value: '' +DROP TABLE CC, C, BB; +DROP TABLE IF EXISTS CC, C, BB; +CREATE TABLE `CC` ( +`pk` int(11) NOT NULL AUTO_INCREMENT, +`int_nokey` int(11) NOT NULL, +`int_key` int(11) NOT NULL, +`date_key` date NOT NULL, +`datetime_key` datetime NOT NULL, +`varchar_key` varchar(1) NOT NULL, +`varchar_nokey` varchar(1) NOT NULL, +PRIMARY KEY (`pk`), +KEY `int_key` (`int_key`), +KEY `date_key` (`date_key`), +KEY `datetime_key` (`datetime_key`), +KEY `varchar_key` (`varchar_key`) +) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1; +INSERT INTO `CC` VALUES +(10,0,8,'2007-02-14','2006-07-07 07:26:28','q','q'), +(11,5,8,'2002-10-03','2002-09-23 00:00:00','m','m'), +(12,7,3,'2006-12-02','0000-00-00 00:00:00','j','j'), +(13,1,2,'2007-05-02','2006-06-07 00:00:00','z','z'), +(14,8,2,'2001-11-18','2000-09-16 12:15:34','a','a'), +(15,2,6,'2006-09-09','2007-08-05 15:47:52','',''), +(16,1,8,'0000-00-00','0000-00-00 00:00:00','e','e'), +(17,8,9,'2003-07-22','2005-12-02 19:34:26','t','t'), +(18,5,2,'2001-12-22','0000-00-00 00:00:00','q','q'), +(19,4,6,'0000-00-00','0000-00-00 00:00:00','b','b'), +(20,5,5,'2006-09-02','2007-12-28 00:00:00','w','w'), +(21,3,2,'0000-00-00','2004-08-02 11:48:43','m','m'), +(22,0,4,'0000-00-00','0000-00-00 00:00:00','x','x'), +(23,8,9,'2001-02-28','2004-04-19 12:18:43','',''), +(24,0,6,'0000-00-00','2009-04-27 00:00:00','w','w'), +(25,4,5,'2007-05-19','2006-10-20 14:52:15','x','x'), +(26,0,0,'2005-02-15','0000-00-00 00:00:00','e','e'), +(27,0,0,'2000-10-19','2002-03-22 11:48:37','e','e'), +(28,2,8,'2005-07-07','0000-00-00 00:00:00','p','p'), +(29,0,0,'2008-10-18','2001-01-04 03:55:07','x','x'); +CREATE TABLE `C` ( +`pk` int(11) NOT NULL AUTO_INCREMENT, +`int_nokey` int(11) NOT NULL, +`int_key` int(11) NOT NULL, +`date_key` date NOT NULL, +`datetime_key` datetime NOT NULL, +`varchar_key` varchar(1) NOT NULL, +`varchar_nokey` varchar(1) NOT NULL, +PRIMARY KEY (`pk`), +KEY `int_key` (`int_key`), +KEY `date_key` (`date_key`), +KEY `datetime_key` (`datetime_key`), +KEY `varchar_key` (`varchar_key`) +) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1; +INSERT INTO `C` VALUES +(1,9,9,'2007-12-01','0000-00-00 00:00:00','p','p'), +(2,0,0,'0000-00-00','2002-02-09 07:38:13','v','v'), +(3,8,6,'0000-00-00','2001-05-03 12:08:14','t','t'), +(4,3,6,'2002-05-07','0000-00-00 00:00:00','u','u'), +(5,7,6,'0000-00-00','2009-07-28 03:43:30','n','n'), +(6,0,4,'0000-00-00','2009-08-04 00:00:00','l','l'), +(7,1,7,'0000-00-00','0000-00-00 00:00:00','h','h'), +(8,9,4,'0000-00-00','0000-00-00 00:00:00','u','u'), +(9,0,8,'0000-00-00','2005-08-02 17:16:54','n','n'), +(10,9,4,'2000-12-18','2002-12-21 00:00:00','j','j'), +(11,0,7,'2005-11-13','2005-08-15 12:37:35','k','k'), +(12,5,5,'0000-00-00','0000-00-00 00:00:00','e','e'), +(13,0,0,'2003-11-12','2006-03-10 00:00:00','i','i'), +(14,8,5,'2006-02-20','2005-05-16 11:02:36','u','u'), +(15,8,7,'2005-02-12','2008-11-02 00:00:00','n','n'), +(16,5,2,'2009-07-20','2006-03-15 00:00:00','b','b'), +(17,1,8,'2005-02-24','0000-00-00 00:00:00','x','x'), +(18,7,0,'0000-00-00','0000-00-00 00:00:00','',''), +(19,0,9,'0000-00-00','2008-12-17 20:15:40','q','q'), +(20,9,5,'0000-00-00','0000-00-00 00:00:00','u','u'); +CREATE TABLE `BB` ( +`pk` int(11) NOT NULL AUTO_INCREMENT, +`int_nokey` int(11) NOT NULL, +`int_key` int(11) NOT NULL, +`date_key` date NOT NULL, +`datetime_key` datetime NOT NULL, +`varchar_key` varchar(1) NOT NULL, +`varchar_nokey` varchar(1) NOT NULL, +PRIMARY KEY (`pk`), +KEY `int_key` (`int_key`), +KEY `date_key` (`date_key`), +KEY `datetime_key` (`datetime_key`), +KEY `varchar_key` (`varchar_key`) +) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=latin1; +INSERT INTO `BB` VALUES (10,8,5,'0000-00-00','2007-08-19 +08:08:38','i','i'),(11,0,8,'2005-08-18','2000-05-21 03:51:51','',''); +SELECT DISTINCT BIT_AND( OUTR . `datetime_key` ) AS X +FROM C AS OUTR +WHERE ( OUTR . `int_nokey` , OUTR . `pk` ) IN ( +SELECT DISTINCT INNR . `pk` AS X , INNR . `pk` AS Y +FROM CC AS INNR2 LEFT JOIN BB AS INNR ON +( INNR2 . `varchar_nokey` = INNR . `varchar_key` ) +WHERE INNR . `date_key` BETWEEN '2009-04-26' AND '2004-08-21' ) +AND OUTR . `pk` = 9 +ORDER BY OUTR . `int_key` , OUTR . `pk`; +X +18446744073709551615 +DROP TABLE CC, C, BB; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug45221.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug45221.result new file mode 100644 index 00000000000..45e502ca5a4 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug45221.result @@ -0,0 +1,100 @@ +CREATE TABLE `CC` ( +`pk` int(11) NOT NULL AUTO_INCREMENT, +`int_key` int(11) DEFAULT NULL, +`date_nokey` date DEFAULT NULL, +`datetime_nokey` datetime DEFAULT NULL, +PRIMARY KEY (`pk`), +KEY `int_key` (`int_key`), +KEY `varchar_key` (`int_key`) +) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1; +INSERT INTO `CC` VALUES (10,8,NULL,'2002-02-26 06:14:37'),(11,9,'2006-06-14','1900-01-01 00:00:00'),(12,9,'2002-09-12','2006-12-03 09:37:26'),(13,186,'2005-02-15','2008-05-26 12:27:10'),(14,NULL,NULL,'2004-12-14 16:37:30'),(15,2,'2008-11-04','2003-02-11 21:19:41'),(16,3,'2004-09-04','2009-10-18 02:27:49'),(17,0,'2006-06-05','2000-09-26 07:45:57'),(18,133,'1900-01-01',NULL),(19,1,'1900-01-01','2005-11-10 12:40:29'),(20,8,'1900-01-01','2009-04-25 00:00:00'),(21,5,'2005-01-13','2002-11-27 00:00:00'),(22,5,'2006-05-21','2004-01-26 20:32:32'),(23,8,'2003-09-08','2007-10-26 11:41:40'),(24,6,'2006-12-23','2005-10-07 00:00:00'),(25,51,'2006-10-15','2000-07-15 05:00:34'),(26,4,'2005-04-06','2000-04-03 16:33:32'),(27,7,'2008-04-07',NULL),(28,6,'2006-10-10','2001-04-25 01:26:12'),(29,4,'1900-01-01','2000-12-27 00:00:00'); +CREATE TABLE `C` ( +`pk` int(11) NOT NULL AUTO_INCREMENT, +`int_key` int(11) DEFAULT NULL, +`date_nokey` date DEFAULT NULL, +`datetime_nokey` datetime DEFAULT NULL, +PRIMARY KEY (`pk`), +KEY `int_key` (`int_key`), +KEY `varchar_key` (`int_key`) +) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1; +INSERT INTO `C` VALUES (1,2,NULL,'2004-10-11 18:13:16'),(2,9,'2001-09-19',NULL),(3,3,'2004-09-12','1900-01-01 00:00:00'),(4,9,NULL,'2009-07-25 00:00:00'),(5,NULL,'2002-07-19',NULL),(6,9,'2002-12-16','2008-07-27 00:00:00'),(7,3,'2006-02-08','2002-11-13 16:37:31'),(8,8,'2006-08-28','1900-01-01 00:00:00'),(9,8,'2001-04-14','2003-12-10 00:00:00'),(10,53,'2000-01-05','2001-12-21 22:38:22'),(11,0,'2003-12-06','2008-12-13 23:16:44'),(12,5,'1900-01-01','2005-08-15 12:39:41'),(13,166,'2002-11-27',NULL),(14,3,NULL,'2006-09-11 12:06:14'),(15,0,'2003-05-27','2007-12-15 12:39:34'),(16,1,'2005-05-03','2005-08-09 00:00:00'),(17,9,'2001-04-18','2001-09-02 22:50:02'),(18,5,'2005-12-27','2005-12-16 22:58:11'),(19,6,'2004-08-20','2007-04-19 00:19:53'),(20,2,'1900-01-01','1900-01-01 00:00:00'); +SELECT `pk` +FROM C OUTR +WHERE `pk` IN ( +SELECT `int_key` +FROM CC +WHERE `date_nokey` < `datetime_nokey` XOR OUTR .`date_nokey` ) ; +pk +9 +2 +5 +6 +SELECT `pk` +FROM C +WHERE `pk` IN ( +SELECT `int_key` +FROM CC +WHERE `date_nokey` < `datetime_nokey` XOR '2009-11-25' ) ; +pk +2 +4 +5 +6 +9 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '2009-11-25' +Warning 1292 Truncated incorrect INTEGER value: '2009-11-25' +Warning 1292 Truncated incorrect INTEGER value: '2009-11-25' +Warning 1292 Truncated incorrect INTEGER value: '2009-11-25' +Warning 1292 Truncated incorrect INTEGER value: '2009-11-25' +Warning 1292 Truncated incorrect INTEGER value: '2009-11-25' +Warning 1292 Truncated incorrect INTEGER value: '2009-11-25' +Warning 1292 Truncated incorrect INTEGER value: '2009-11-25' +Warning 1292 Truncated incorrect INTEGER value: '2009-11-25' +Warning 1292 Truncated incorrect INTEGER value: '2009-11-25' +Warning 1292 Truncated incorrect INTEGER value: '2009-11-25' +Warning 1292 Truncated incorrect INTEGER value: '2009-11-25' +Warning 1292 Truncated incorrect INTEGER value: '2009-11-25' +Warning 1292 Truncated incorrect INTEGER value: '2009-11-25' +Warning 1292 Truncated incorrect INTEGER value: '2009-11-25' +Warning 1292 Truncated incorrect INTEGER value: '2009-11-25' +DROP TABLE CC; +DROP TABLE C; +CREATE TABLE `CC` ( +`pk` int(11) NOT NULL AUTO_INCREMENT, +`int_nokey` int(11) DEFAULT NULL, +`int_key` int(11) DEFAULT NULL, +`date_nokey` date DEFAULT NULL, +`datetime_key` datetime DEFAULT NULL, +`datetime_nokey` datetime DEFAULT NULL, +PRIMARY KEY (`pk`), +KEY `int_key` (`int_key`), +KEY `datetime_key` (`datetime_key`), +KEY `varchar_key` (`int_key`) +) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1; +INSERT INTO `CC` VALUES (10,7,8,NULL,'2002-02-26 06:14:37','2002-02-26 06:14:37'),(11,1,9,'2006-06-14','1900-01-01 00:00:00','1900-01-01 00:00:00'),(12,5,9,'2002-09-12','2006-12-03 09:37:26','2006-12-03 09:37:26'),(13,3,186,'2005-02-15','2008-05-26 12:27:10','2008-05-26 12:27:10'),(14,6,NULL,NULL,'2004-12-14 16:37:30','2004-12-14 16:37:30'),(15,92,2,'2008-11-04','2003-02-11 21:19:41','2003-02-11 21:19:41'),(16,7,3,'2004-09-04','2009-10-18 02:27:49','2009-10-18 02:27:49'),(17,NULL,0,'2006-06-05','2000-09-26 07:45:57','2000-09-26 07:45:57'),(18,3,133,'1900-01-01',NULL,NULL),(19,5,1,'1900-01-01','2005-11-10 12:40:29','2005-11-10 12:40:29'),(20,1,8,'1900-01-01','2009-04-25 00:00:00','2009-04-25 00:00:00'),(21,2,5,'2005-01-13','2002-11-27 00:00:00','2002-11-27 00:00:00'),(22,NULL,5,'2006-05-21','2004-01-26 20:32:32','2004-01-26 20:32:32'),(23,1,8,'2003-09-08','2007-10-26 11:41:40','2007-10-26 11:41:40'),(24,0,6,'2006-12-23','2005-10-07 00:00:00','2005-10-07 00:00:00'),(25,210,51,'2006-10-15','2000-07-15 05:00:34','2000-07-15 05:00:34'),(26,8,4,'2005-04-06','2000-04-03 16:33:32','2000-04-03 16:33:32'),(27,7,7,'2008-04-07',NULL,NULL),(28,5,6,'2006-10-10','2001-04-25 01:26:12','2001-04-25 01:26:12'),(29,NULL,4,'1900-01-01','2000-12-27 00:00:00','2000-12-27 00:00:00'); +CREATE TABLE `C` ( +`pk` int(11) NOT NULL AUTO_INCREMENT, +`int_nokey` int(11) DEFAULT NULL, +`int_key` int(11) DEFAULT NULL, +`date_nokey` date DEFAULT NULL, +`datetime_key` datetime DEFAULT NULL, +`datetime_nokey` datetime DEFAULT NULL, +PRIMARY KEY (`pk`), +KEY `int_key` (`int_key`), +KEY `datetime_key` (`datetime_key`), +KEY `varchar_key` (`int_key`) +) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1; +INSERT INTO `C` VALUES (1,NULL,2,NULL,'2004-10-11 18:13:16','2004-10-11 18:13:16'),(2,7,9,'2001-09-19',NULL,NULL),(3,9,3,'2004-09-12','1900-01-01 00:00:00','1900-01-01 00:00:00'),(4,7,9,NULL,'2009-07-25 00:00:00','2009-07-25 00:00:00'),(5,4,NULL,'2002-07-19',NULL,NULL),(6,2,9,'2002-12-16','2008-07-27 00:00:00','2008-07-27 00:00:00'),(7,6,3,'2006-02-08','2002-11-13 16:37:31','2002-11-13 16:37:31'),(8,8,8,'2006-08-28','1900-01-01 00:00:00','1900-01-01 00:00:00'),(9,NULL,8,'2001-04-14','2003-12-10 00:00:00','2003-12-10 00:00:00'),(10,5,53,'2000-01-05','2001-12-21 22:38:22','2001-12-21 22:38:22'),(11,NULL,0,'2003-12-06','2008-12-13 23:16:44','2008-12-13 23:16:44'),(12,6,5,'1900-01-01','2005-08-15 12:39:41','2005-08-15 12:39:41'),(13,188,166,'2002-11-27',NULL,NULL),(14,2,3,NULL,'2006-09-11 12:06:14','2006-09-11 12:06:14'),(15,1,0,'2003-05-27','2007-12-15 12:39:34','2007-12-15 12:39:34'),(16,1,1,'2005-05-03','2005-08-09 00:00:00','2005-08-09 00:00:00'),(17,0,9,'2001-04-18','2001-09-02 22:50:02','2001-09-02 22:50:02'),(18,9,5,'2005-12-27','2005-12-16 22:58:11','2005-12-16 22:58:11'),(19,NULL,6,'2004-08-20','2007-04-19 00:19:53','2007-04-19 00:19:53'),(20,4,2,'1900-01-01','1900-01-01 00:00:00','1900-01-01 00:00:00'); +SELECT OUTR . `pk` AS X +FROM C AS OUTR +WHERE OUTR . `pk` IN ( +SELECT INNR . `int_key` AS Y +FROM CC AS INNR +WHERE INNR . `date_nokey` < INNR . `datetime_nokey` XOR OUTR . `date_nokey` BETWEEN '2004-07-10' AND '2009-11-25' +ORDER BY INNR . `int_nokey` ) AND ( OUTR . `datetime_key` BETWEEN '2000-05-25' AND '2004-08-07' OR OUTR . `datetime_nokey` = '2007-10-24' ) +ORDER BY OUTR . `int_key` , OUTR . `pk`; +X +9 +DROP TABLE CC; +DROP TABLE C; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug49129.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug49129.result new file mode 100644 index 00000000000..2612e4d0bf2 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug49129.result @@ -0,0 +1,39 @@ +SET SESSION optimizer_switch = 'firstmatch=off,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on'; +CREATE TABLE t0 (a INT); +INSERT INTO t0 VALUES (0),(1),(2),(3),(4); +CREATE TABLE t1 (a INT, b INT, KEY(a)); +INSERT INTO t1 SELECT a, a from t0; +CREATE TABLE t2 (a INT, b INT, PRIMARY KEY(a)); +INSERT INTO t2 SELECT * FROM t1; +UPDATE t1 SET a=3, b=11 WHERE a=4; +UPDATE t2 SET b=11 WHERE a=3; + +# This result is wrong, but will be fixed by Bug#46556 +SELECT * FROM t0 WHERE t0.a IN +(SELECT t1.a FROM t1, t2 WHERE t2.a=t0.a AND t1.b=t2.b); +a +0 +1 +2 +3 +SET join_cache_level = 6; + +# This result is even more wrong ;-) +SELECT * FROM t0 WHERE t0.a IN +(SELECT t1.a FROM t1, t2 WHERE t2.a=t0.a AND t1.b=t2.b); +a +0 +1 +2 +3 + +# This result is correct +SET SESSION optimizer_switch = 'semijoin=off'; +SELECT * FROM t0 WHERE t0.a IN +(SELECT t1.a FROM t1, t2 WHERE t2.a=t0.a AND t1.b=t2.b); +a +0 +1 +2 +3 +DROP TABLE t0, t1, t2; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug36981.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug36981.test new file mode 100644 index 00000000000..586602c7ae8 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug36981.test @@ -0,0 +1,14 @@ +# test for BUG#36981 "innodb crash when selecting for update" + +--source include/have_debug.inc +--source include/have_innodb.inc + +# crash requires this +set session debug="+d,optimizer_innodb_icp"; + +create table `t1` (`c1` char(1) default null,`c2` char(10) default null, +key (`c1`)) +engine=innodb default charset=latin1; +insert into `t1` values ('3',null); +select * from `t1` where `c1`='3' for update; +drop table `t1`; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug40992.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug40992.test new file mode 100644 index 00000000000..36fe7c4a60f --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug40992.test @@ -0,0 +1,21 @@ +--echo # +--echo # Bug#40992 - InnoDB: Crash when engine_condition_pushdown is on +--echo # + +--source include/have_debug.inc +--source include/have_innodb.inc + +# Crash requires that we enable Index Condition Pushdown in InnoDB +set session debug="+d,optimizer_innodb_icp"; + +CREATE TABLE t ( + dummy INT PRIMARY KEY, + a INT UNIQUE, + b int +) ENGINE=InnoDB; + +INSERT INTO t VALUES (1,1,1),(3,3,3),(5,5,5); + +SELECT * FROM t WHERE a > 2 FOR UPDATE; + +DROP TABLE t; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41029-master.opt b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41029-master.opt new file mode 100644 index 00000000000..bb3f82d4dd6 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41029-master.opt @@ -0,0 +1 @@ +--loose-innodb_lock_wait_timeout=3 diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41029.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41029.test new file mode 100644 index 00000000000..ff3dd4964af --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41029.test @@ -0,0 +1,44 @@ +# test for BUG#41029: +# "MRR: SELECT FOR UPDATE fails to lock gaps (InnoDB table)" + +--source include/have_debug.inc +--source include/have_innodb.inc + +select @default_binlog_format:=@@global.binlog_format; +set global binlog_format=row; + +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); + +connection con1; + +# bug requires this +set session debug="+d,optimizer_innodb_ds_mrr"; + +set autocommit=0; +use test; +drop table if exists t1; +create table t1 (dummy int primary key, a int unique, b int) engine=innodb; +insert into t1 values(1,1,1),(3,3,3),(5,5,5); +commit; +set session transaction isolation level repeatable read; +select @@tx_isolation; +start transaction; +select * from t1 where a > 2 for update; + +connection con2; + +use test; +set autocommit=0; +start transaction; +select 1; +--error ER_LOCK_WAIT_TIMEOUT +insert into t1 values(2,2,2); +rollback; + +connection con1; +rollback; + +drop table t1; +connection default; +set global binlog_format=@default_binlog_format; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra1-innodb.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra1-innodb.test new file mode 100644 index 00000000000..deb90136326 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra1-innodb.test @@ -0,0 +1,487 @@ +set optimizer_use_mrr='disable'; +--disable_warnings +DROP DATABASE IF EXISTS d1; +DROP DATABASE IF EXISTS d2; +DROP DATABASE IF EXISTS d3; +--enable_warnings +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; + diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra1.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra1.test new file mode 100644 index 00000000000..deb90136326 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra1.test @@ -0,0 +1,487 @@ +set optimizer_use_mrr='disable'; +--disable_warnings +DROP DATABASE IF EXISTS d1; +DROP DATABASE IF EXISTS d2; +DROP DATABASE IF EXISTS d3; +--enable_warnings +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; + diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra2-innodb.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra2-innodb.test new file mode 100644 index 00000000000..2590ed7b0e3 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra2-innodb.test @@ -0,0 +1,486 @@ +--disable_warnings +DROP DATABASE IF EXISTS d1; +DROP DATABASE IF EXISTS d2; +DROP DATABASE IF EXISTS d3; +--enable_warnings +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; + diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra2.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra2.test new file mode 100644 index 00000000000..2590ed7b0e3 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra2.test @@ -0,0 +1,486 @@ +--disable_warnings +DROP DATABASE IF EXISTS d1; +DROP DATABASE IF EXISTS d2; +DROP DATABASE IF EXISTS d3; +--enable_warnings +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; +CREATE DATABASE d1; +CREATE DATABASE d2; +CREATE DATABASE d3; +CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2; +SELECT * FROM d1.t1 ORDER BY c1; +SELECT * FROM d2.t2 ORDER BY c1; +SELECT * FROM d3.t3 ORDER BY c1; +DROP DATABASE d1; +DROP DATABASE d2; +DROP DATABASE d3; + diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra3-innodb.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra3-innodb.test new file mode 100644 index 00000000000..70e727a4c43 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra3-innodb.test @@ -0,0 +1,363 @@ +--disable_warnings +--enable_warnings +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; + diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra3.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra3.test new file mode 100644 index 00000000000..70e727a4c43 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra3.test @@ -0,0 +1,363 @@ +--disable_warnings +--enable_warnings +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; + diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra4-innodb.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra4-innodb.test new file mode 100644 index 00000000000..ce0be3c7b12 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra4-innodb.test @@ -0,0 +1,363 @@ +--disable_warnings +--enable_warnings +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; + diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra4.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra4.test new file mode 100644 index 00000000000..ce0be3c7b12 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra4.test @@ -0,0 +1,363 @@ +--disable_warnings +--enable_warnings +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2)); +INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5); +INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6); +INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15); +DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2; +SELECT * FROM t1 ORDER BY c1; +SELECT * FROM t2 ORDER BY c1; +SELECT * FROM t3 ORDER BY c1; +DROP TABLE t1,t2,t3; + diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996.test new file mode 100644 index 00000000000..b8040b9714a --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996.test @@ -0,0 +1,14 @@ +# Test for BUG#41996 "multi-table delete crashes server (InnoDB +# table)" + +--source include/have_debug.inc +--source include/have_innodb.inc + +# crash requires this +set session debug="+d,optimizer_innodb_icp"; + +drop table if exists `t1`; +create table `t1` (`c` bigint, key(`c`),`a` int)engine=innodb; +insert into `t1` values(2,2); +delete `t1` from `t1` `a`, `t1` where `a`.`a`=`t1`.`c` ; +drop table `t1`; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug42991.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug42991.test new file mode 100644 index 00000000000..d3eb1e726a2 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug42991.test @@ -0,0 +1,248 @@ +--source include/have_debug.inc
+# Test for BUG#42991 "invalid memory access and/or crash when using
+# index condition pushdown + InnoDB"
+# Note that you need to run with --valgrind to see the warnings
+# about invalid memory accesses.
+
+--source include/have_innodb.inc
+
+# Valgrind errors happen only with this:
+set session debug="+d,optimizer_innodb_icp";
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+
+DROP TABLE IF EXISTS `table5`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `table5` (
+ `col0` mediumtext,
+ `col1` varchar(90) DEFAULT NULL,
+ `col2` tinytext,
+ `col3` time DEFAULT NULL,
+ `col4` tinyint(1) DEFAULT NULL,
+ `col5` tinytext,
+ `col6` tinyint(1) DEFAULT NULL,
+ `col7` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `col8` tinyblob,
+ `col9` tinyint(4) DEFAULT NULL,
+ `col10` year(4) DEFAULT NULL,
+ `col11` set('test1','test2','test3') DEFAULT NULL,
+ `col12` text,
+ `col13` char(248) DEFAULT NULL,
+ `col14` bigint(20) DEFAULT NULL,
+ `col15` text,
+ `col16` tinyint(4) DEFAULT NULL,
+ `col17` decimal(10,0) DEFAULT NULL,
+ `col18` set('test1','test2','test3') DEFAULT NULL,
+ `col19` varchar(255) DEFAULT NULL,
+ `col20` float DEFAULT NULL,
+ `col21` int(11) DEFAULT NULL,
+ `col22` text,
+ `col23` tinyint(1) DEFAULT NULL,
+ `col24` decimal(10,0) NOT NULL DEFAULT '0',
+ `col25` double DEFAULT NULL,
+ `col26` float DEFAULT NULL,
+ `col27` tinyblob,
+ `col28` decimal(10,0) DEFAULT NULL,
+ `col29` mediumblob,
+ `col30` date DEFAULT NULL,
+ `col31` longtext,
+ `col32` date DEFAULT NULL,
+ `col33` float DEFAULT NULL,
+ `col34` bigint(20) DEFAULT NULL,
+ `col35` tinytext,
+ `col36` mediumtext,
+ `col37` time DEFAULT NULL,
+ `col38` int(11) DEFAULT NULL,
+ `col39` tinyint(4) DEFAULT NULL,
+ `col40` set('test1','test2','test3') DEFAULT NULL,
+ `col41` char(130) DEFAULT NULL,
+ `col42` smallint(6) DEFAULT NULL,
+ `col43` int(11) DEFAULT NULL,
+ `col44` mediumtext,
+ `col45` varchar(126) DEFAULT NULL,
+ `col46` int(11) DEFAULT NULL,
+ `col47` double DEFAULT NULL,
+ `col48` bigint(20) DEFAULT NULL,
+ `col49` mediumtext,
+ `col50` tinyblob,
+ `col51` mediumint(9) DEFAULT NULL,
+ `col52` text,
+ `col53` varchar(208) DEFAULT NULL,
+ `col54` varchar(207) DEFAULT NULL,
+ `col55` decimal(10,0) DEFAULT NULL,
+ `col56` datetime DEFAULT NULL,
+ `col57` enum('test1','test2','test3') DEFAULT NULL,
+ `col58` decimal(10,0) DEFAULT NULL,
+ `col59` tinyblob,
+ `col60` varchar(73) DEFAULT NULL,
+ `col61` mediumtext,
+ `col62` tinyblob,
+ `col63` datetime DEFAULT NULL,
+ `col64` decimal(10,0) DEFAULT NULL,
+ `col65` mediumint(9) DEFAULT NULL,
+ `col66` datetime DEFAULT NULL,
+ `col67` decimal(10,0) DEFAULT NULL,
+ `col68` tinyint(4) DEFAULT NULL,
+ `col69` varchar(58) DEFAULT NULL,
+ `col70` decimal(10,0) DEFAULT NULL,
+ `col71` mediumtext,
+ `col72` date DEFAULT NULL,
+ `col73` time DEFAULT NULL,
+ `col74` double DEFAULT NULL,
+ `col75` decimal(10,0) DEFAULT NULL,
+ `col76` mediumblob,
+ `col77` double DEFAULT NULL,
+ `col78` year(4) DEFAULT NULL,
+ `col79` year(4) DEFAULT NULL,
+ `col80` varchar(255) DEFAULT NULL,
+ `col81` blob,
+ `col82` bigint(20) DEFAULT NULL,
+ `col83` enum('test1','test2','test3') DEFAULT NULL,
+ `col84` decimal(10,0) DEFAULT NULL,
+ `col85` set('test1','test2','test3') DEFAULT NULL,
+ `col86` mediumtext,
+ `col87` varchar(255) DEFAULT NULL,
+ `col88` time DEFAULT NULL,
+ `col89` enum('test1','test2','test3') DEFAULT NULL,
+ `col90` decimal(10,0) DEFAULT NULL,
+ `col91` float DEFAULT NULL,
+ `col92` datetime DEFAULT NULL,
+ `col93` tinytext,
+ `col94` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `col95` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `col96` text,
+ `col97` double DEFAULT NULL,
+ `col98` varchar(198) DEFAULT NULL,
+ `col99` time DEFAULT NULL,
+ `col100` tinyint(4) DEFAULT NULL,
+ `col101` bigint(20) DEFAULT NULL,
+ `col102` varchar(255) DEFAULT NULL,
+ `col103` varchar(255) DEFAULT NULL,
+ `col104` mediumint(9) DEFAULT NULL,
+ `col105` mediumtext,
+ `col106` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `col107` smallint(6) DEFAULT NULL,
+ `col108` decimal(10,0) DEFAULT NULL,
+ `col109` decimal(10,0) DEFAULT NULL,
+ `col110` float DEFAULT NULL,
+ `col111` decimal(10,0) DEFAULT NULL,
+ `col112` double DEFAULT NULL,
+ `col113` tinytext,
+ `col114` float DEFAULT NULL,
+ `col115` varchar(7) DEFAULT NULL,
+ `col116` longtext,
+ `col117` date DEFAULT NULL,
+ `col118` bigint(20) DEFAULT NULL,
+ `col119` text,
+ `col120` bigint(20) DEFAULT NULL,
+ `col121` blob,
+ `col122` char(110) DEFAULT NULL,
+ `col123` decimal(10,0) DEFAULT NULL,
+ `col124` mediumblob,
+ `col125` decimal(10,0) DEFAULT NULL,
+ `col126` decimal(10,0) DEFAULT NULL,
+ `col127` tinyint(1) DEFAULT NULL,
+ `col128` time DEFAULT NULL,
+ `col129` tinyblob,
+ `col130` tinyblob,
+ `col131` date DEFAULT NULL,
+ `col132` int(11) DEFAULT NULL,
+ `col133` varchar(123) DEFAULT NULL,
+ `col134` char(238) DEFAULT NULL,
+ `col135` varchar(225) DEFAULT NULL,
+ `col136` longtext,
+ `col137` varchar(255) DEFAULT NULL,
+ `col138` double DEFAULT NULL,
+ `col139` tinyblob,
+ `col140` datetime DEFAULT NULL,
+ `col141` tinytext,
+ `col142` varchar(255) DEFAULT NULL,
+ `col143` bigint(20) DEFAULT NULL,
+ `col144` varchar(236) DEFAULT NULL,
+ `col145` text,
+ `col146` year(4) DEFAULT NULL,
+ `col147` decimal(10,0) DEFAULT NULL,
+ `col148` text,
+ `col149` mediumblob,
+ `col150` tinyint(4) DEFAULT NULL,
+ `col151` tinyint(1) DEFAULT NULL,
+ `col152` varchar(72) DEFAULT NULL,
+ `col153` int(11) DEFAULT NULL,
+ `col154` varchar(165) DEFAULT NULL,
+ `col155` tinyint(4) DEFAULT NULL,
+ `col156` mediumtext,
+ `col157` double DEFAULT NULL,
+ `col158` time DEFAULT NULL,
+ `col159` mediumblob,
+ `col160` varchar(255) DEFAULT NULL,
+ `col161` datetime DEFAULT NULL,
+ `col162` double DEFAULT NULL,
+ `col163` blob,
+ `col164` enum('test1','test2','test3') DEFAULT NULL,
+ `col165` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `col166` date DEFAULT NULL,
+ `col167` tinyblob,
+ `col168` tinyblob,
+ `col169` varchar(255) DEFAULT NULL,
+ `col170` datetime DEFAULT NULL,
+ `col171` bigint(20) DEFAULT NULL,
+ `col172` varchar(30) DEFAULT NULL,
+ `col173` longtext,
+ `col174` time DEFAULT NULL,
+ `col175` float DEFAULT NULL,
+ PRIMARY KEY (`col24`),
+ KEY `idx0` (`col16`,`col156`(139),`col97`,`col120`),
+ KEY `idx1` (`col24`,`col0`(108)),
+ KEY `idx2` (`col117`,`col173`(34),`col132`,`col82`),
+ KEY `idx3` (`col2`(86)),
+ KEY `idx4` (`col2`(43)),
+ KEY `idx5` (`col83`,`col35`(87),`col111`),
+ KEY `idx6` (`col6`,`col134`,`col92`),
+ KEY `idx7` (`col56`),
+ KEY `idx8` (`col30`,`col53`,`col129`(66)),
+ KEY `idx9` (`col53`,`col113`(211),`col32`,`col15`(75)),
+ KEY `idx10` (`col34`),
+ KEY `idx11` (`col126`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
+
+
+LOCK TABLES `table5` WRITE;
+/*!40000 ALTER TABLE `table5` DISABLE KEYS */;
+INSERT INTO `table5` VALUES ('referenda','hermaphroditism','superable','00:00:00',-128,NULL,-128,'0000-00-00 00:00:00',NULL,-128,1901,NULL,'blandly',NULL,6541,'unsuspectingly',NULL,'7250','',NULL,-31358,26248,'Kilmarnock\'s',127,'-27305',28987,NULL,NULL,'-30388','utilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitarians','0000-00-00','Agincourt','0000-00-00',-28063,27242,'readies',NULL,'00:00:00',NULL,-128,'',NULL,NULL,18719,NULL,NULL,14038,17275,NULL,'gait\'s','honeymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'sho',8860,NULL,'demigod','outpulling',NULL,'1904-01-17 09:51:06','test1','-18008','grotesqueness\'sgrotesqueness\'sgrotesqueness\'sgrotesqueness\'sgrotesqueness\'sgrotesqueness\'sgrotesqueness\'s','Oakleil\'s','Shostakovich','indiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscre','2076-10-05 02:05:43','29914',-18885,'2088-05-25 13:36:33','25',-128,'Bob','-14559','ammeter','0000-00-00','00:00:00',-29756,NULL,'digressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigression',-23894,1963,1915,'SadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadye',NULL,NULL,'','17512','','anaphylaxis\'s','chiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schise','50:11:25','test1','-13685',-18328,'2020-01-19 22:04:54',NULL,'1988-05-10 10:30:56','0000-00-00 00:00:00','Birdie\'s',-27746,NULL,'179:19:25',-128,24141,'radiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparen','ingroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'sing',18950,'Beaulieu','0000-00-00 00:00:00',-23421,'-2865',NULL,NULL,NULL,NULL,'vandalizes',-24683,'interop','Apis\'s','0000-00-00',19745,'Volgograd\'s',-15194,NULL,'Binni','4540','phylumphylumphylumphylum','-25781',NULL,-128,'406:37:03','posthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthastepos','manneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristman','0000-00-00',19774,'shariah',NULL,'aquarelle','homographic',NULL,-18959,'thoroughfarethoroughfarethoroughfarethoroughfarethoroughfarethoroughfare','2000-09-05 03:33:50','Baptlsta','Witt\'sWitt\'sWitt\'sWitt\'sWitt\'sWitt\'sWitt\'sWitt\'s',4727,NULL,'posting',2119,'32416',NULL,'charredcharredcharredcharredcharredcharredcharredcharredcharredcharred',-128,NULL,'Rollin\'s',NULL,NULL,127,'waviness\'s',11164,'424:28:18','FaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucher','stalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'s','1901-01-29 13:48:34',-31988,'Dyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'s','','2022-01-01 21:14:30','0000-00-00','conventionalistconventionalistconventionalistconventionalistconventionalistconventionalistconventionalistconventionalist','mirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnesses','tessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stes','2028-05-21 04:56:16',NULL,'Hasid','Hardecanute','00:00:00',-3782);
+INSERT INTO `table5` VALUES ('hemoglobin\'s','Toffey\'s','Juvenal','00:00:00',-128,'harmonicon',-128,'2004-02-13 09:45:46',NULL,NULL,1911,'','Tananarive\'s',NULL,30666,'spiniferous',127,'30675','','Frederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFr',30388,4769,'Erymanthus\'s',127,'-20972',NULL,-17111,'explosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosiveness','-28154','magnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'s','0000-00-00','removes','0000-00-00',16859,NULL,NULL,'Moishe\'s','00:00:00',NULL,NULL,NULL,'hyperform\'s',30540,-26603,'soporific',NULL,NULL,19264,-14618,NULL,'zootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszo',5654,'intermezzi','Atkins\'s','hieroglyphically','15885','2068-10-19 12:22:30','','4972','apatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapa','severeness','pleaders',NULL,'2070-09-15 17:21:46','15245',-18313,'1934-01-01 01:20:15','-3488',127,'Delawarian','14952','foregathers','0000-00-00','00:00:00',-27837,'7143','madhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'s',-17163,1951,2054,'raffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraf','REMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMs',3607,'','-17633','',NULL,NULL,'806:59:31','test1','-29600',20301,'1985-10-09 17:57:25',NULL,'0000-00-00 00:00:00','0000-00-00 00:00:00','Perseid',-32117,'constructer\'s','612:19:03',127,NULL,'overdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingove','Carlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCa',24868,'preamble','0000-00-00 00:00:00',-7582,'-865','-14488',6884,'-24713',NULL,'topknot\'s',18469,NULL,'histrionism\'s','0000-00-00',31715,'Dag',14543,'wooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'s','tightest',NULL,'aquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'s','15603',NULL,-128,'640:34:17','acetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumaceta','torridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridl','9323-05-13',-28292,'Barnaul\'s',NULL,'slanginesses','supernova',NULL,20804,NULL,'2020-10-05 12:00:38','rive',NULL,-31498,'considerateness\'s','nevus\'s',1901,'-12956','fashioner\'s','unfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'s',-128,127,'nephralgia\'s',13881,'sciatically',NULL,'Tuesday',21227,'00:00:00','halocarbons','duvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduv','2075-01-21 10:49:44',-19735,'snubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubs','test1','0000-00-00 00:00:00','0000-00-00','kiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkib',NULL,'connoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseurscon','1953-01-23 17:36:00',NULL,'Principal',NULL,'316:28:48',NULL);
+INSERT INTO `table5` VALUES (NULL,'Annmarie','intangibleness\'s','00:00:00',-128,'transmogrify',127,'0000-00-00 00:00:00',NULL,127,2093,'','enamored','refired',-21296,'neglectful',127,'-9992','',NULL,NULL,3583,'Lockheed\'s',127,'-15717',-29743,-16280,'embouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembou','-24875',NULL,'0000-00-00',NULL,'0000-00-00',30124,20356,'drinkable','obscenity','00:00:00',NULL,127,'',NULL,-16664,NULL,'unmoor','Vaughan\'s',30457,-16509,-10049,'squeamishness','encirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencir',-16460,'abatement\'s',NULL,'expatriate','-28670','1925-05-15 11:44:20','','-3762','DelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDel','Skerl\'s','unmatched',NULL,'1980-01-11 16:02:04','25917',18187,'2001-07-26 13:48:08','-28706',127,'gimme','8807',NULL,'0000-00-00','00:00:00',7666,'21762','drawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacks',16131,2031,2077,'subjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysub','Argenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'s',NULL,'','-17090','','fobs','humiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliat','221:02:40','','-1107',4624,'1926-05-11 03:35:52',NULL,'2037-05-13 05:02:44','0000-00-00 00:00:00','Heddie\'s',-6554,NULL,'00:00:00',127,NULL,'lxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlx','RawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawley',6613,'Beaufort','0000-00-00 00:00:00',12214,NULL,'25469',-26474,'12062',NULL,'physiographer',26382,'cosmogo','deportment\'s','0000-00-00',17492,'propretor\'s',NULL,'zingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzing','Suzetta','25513','tearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkers','21613',NULL,-128,'108:58:18','sporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallyspo','Monera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'','0000-00-00',18776,'diffractometer',NULL,'crawls','Inglebert','unguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableun',18112,'melanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanis','1940-05-18 13:21:00','artlessly','blotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblots',6476,NULL,'Bartlett',2143,NULL,'thaumaturge\'s','Hazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'s',127,127,'Winthorpe',-29765,'idiocrasy\'s',NULL,'sandcastles',-9852,'281:41:52','Volny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'s','protagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagon','2076-01-04 15:01:57',NULL,'auscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultations','','0000-00-00 00:00:00','0000-00-00','limenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimen','accommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatingly',NULL,'2018-01-01 05:48:54',17404,NULL,NULL,'195:36:50',24658);
+INSERT INTO `table5` VALUES ('caddishly',NULL,'Kotah','00:00:00',-128,'tailoring',127,'0000-00-00 00:00:00','trustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustie',-128,1967,NULL,NULL,'parallelisms',NULL,NULL,127,NULL,'',NULL,NULL,-513,NULL,NULL,'-14518',NULL,-22393,'AngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAng','32257','regalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregaling','0000-00-00','newspaperwoman','0000-00-00',24845,-17741,'impassiveness','Antillean','00:00:00',-13615,-128,'','gantries',-27983,-6070,'Benetton','aridest',NULL,21574,-25634,'McWilliams\'s','burrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowe',18947,NULL,NULL,'surrealistic',NULL,'1954-07-07 08:58:49','test1','-11714','ExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExEx','administrants','Oxycontin','interpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterper','1914-05-28 05:15:03','3942',NULL,'2046-09-07 18:16:36','3220',127,'arising','18472','anacolutha','0000-00-00','613:15:45',NULL,'-23969',NULL,18979,2031,1975,'AlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcesti','septicitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticities',-25058,'',NULL,'','Kulturkampf','pollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpol','00:00:00','','12283',2881,'1926-12-10 09:24:42','Darken\'s','2034-12-21 15:59:00','0000-00-00 00:00:00',NULL,NULL,NULL,'305:05:06',127,NULL,'feudalityfeudality','Merrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMer',-25733,'borak','0000-00-00 00:00:00',-11465,'877',NULL,-1029,'5107',NULL,'Balaton\'s',NULL,'Martian','miserliness','0000-00-00',14689,'catchment',18457,'billet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'s','humerus\'s','24741',NULL,NULL,'-19233',-128,'00:00:00','fashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfas','judiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjud','0000-00-00',15972,'Letrice\'s','hydrographer',NULL,'Federica','evidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevi',4115,'pshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspsh','1924-10-15 16:31:18','Hamlet','trowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'',-3485,'galvanized',NULL,1924,'-22877','unfired','inchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'s',-128,-128,'VHF',-5304,NULL,127,'glossator',16348,'213:10:59','',NULL,'1946-01-11 17:25:16',262,'DoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDouty','test1','0000-00-00 00:00:00','0000-00-00',NULL,'feasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasibl','contortionisticcontortionisticcontortionisticcontortionisticcontortionisticcontortionisticcontortionistic','2027-06-09 07:56:16',6909,'tessitura','indefensible','00:00:00',-6628);
+INSERT INTO `table5` VALUES ('bassoonist\'s',NULL,'refastens','114:27:50',127,'unrestricted',127,'2032-01-13 11:11:22','abstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'s',NULL,1955,'','Hodosh','allocates',-5067,'Cenac\'s',-128,'31546',NULL,'impassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassab',-30347,292,'Sandi\'s',NULL,'-12402',8206,NULL,'encircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircl','6346','ArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentinians','0000-00-00','Riehl\'s','0000-00-00',NULL,5580,'planets',NULL,'58:35:07',317,127,'','gender',-19514,7112,'Pissaro','relevantly',28777,-21818,-17111,'shoddiness\'s',NULL,NULL,'flee','Boatwright\'s','restrict','12537','2096-04-25 08:45:21','test1','-4613','quagga','masterstroke\'s','overcheck\'s',NULL,'1981-10-14 18:30:02','21097',-26481,'2065-07-11 02:13:44',NULL,NULL,'bathroom','-29833','gracelessness\'s','0000-00-00','09:44:40',-7368,NULL,'applecart\'sapplecart\'sapplecart\'sapplecart\'sapplecart\'sapplecart\'sapplecart\'sapplecart\'s',-21077,2015,2039,'cascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scas','nervingnervingnervingnervingnervingnervingnervingnervingnervingnerving',22043,'','5740','','mustached','actin\'sactin\'sactin\'sactin\'sactin\'sactin\'sactin\'sactin\'sactin\'sactin\'sactin\'s','00:00:00','test1','13871',-22276,'1956-01-05 15:08:47','slimline','0000-00-00 00:00:00','0000-00-00 00:00:00','royally',NULL,'mako','51:54:53',NULL,NULL,'deliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'s','DOADOADOADOADOADOADOADOADOADOADOADOADOA',-16244,'Fayette\'s','2020-06-21 05:34:18',-24353,'24097','-28819',12278,'-2365',21322,'stumps',-61,NULL,'subpoena\'s','0000-00-00',31242,'knicker',23567,NULL,'Cathar','29557','thallusthallusthallusthallusthallusthallusthallusthallusthallusthallus','26114',NULL,-128,'00:00:00','salmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsal','shiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshive','0000-00-00',-3152,'syndesis','misbrands','Smiga','stagnation\'s','nonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricno',NULL,NULL,'1988-09-11 14:33:03',NULL,'provokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglypr',25510,'thunderpeal\'s','hierology',1932,'7729','Fahrenheit','metathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'s',NULL,-128,'sinfonia\'s',-6293,'proactive',127,NULL,-24751,'00:00:00','woodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopper','Constantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'','1997-01-01 22:40:48',NULL,'MatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlick','test1','2000-12-17 11:19:08','0000-00-00',NULL,'cosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmica','Loesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesc','2078-07-25 04:56:08',10472,NULL,NULL,'345:12:02',-13120);
+INSERT INTO `table5` VALUES ('segmentation\'s','shapelessness\'s','coagulators','127:46:24',-128,NULL,127,'0000-00-00 00:00:00','seekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingsee',NULL,2085,'','indent','flyblown',NULL,'Alegre',-128,'-27917','','DesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDes',2473,NULL,'screwball\'s',NULL,'-4861',-7088,-30734,'tambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintam',NULL,NULL,'0000-00-00','Dorcia','0000-00-00',-25745,-1237,'Shoifet\'s','sarsaparillas','21:11:41',31612,-128,'','subway\'s',-5032,-30369,'preventives','lyre',7995,21283,13197,'chippies','rubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubig',19050,'orch','semiliterates','Gerome',NULL,'2058-12-26 21:29:19','',NULL,'dyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdya','Dukas\'s','Christiania','polyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvale','1920-05-23 14:07:00','672',NULL,'1956-06-27 12:15:00','-22658',NULL,'holograph\'s',NULL,'gutsy','0000-00-00','00:00:00',-9558,'1148','fainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfains',NULL,2023,2132,'Balmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBal','overdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdo',-24707,'test1','-13970','','tensility','BuddieBuddieBuddieBuddieBuddieBuddieBuddieBuddieBuddieBuddie','00:00:00','','580',25115,'2000-07-01 09:01:36','apprentice','1992-01-01 08:55:38','0000-00-00 00:00:00','premunire',24664,NULL,'821:21:05',NULL,-29284,'rapidestrapidestrapidestrapidestrapidestrapidestrapidest','convectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorcon',-3808,'intuitively','0000-00-00 00:00:00',-22296,NULL,'2802',28786,NULL,NULL,'loanword',-12107,'deodori','strophe','0000-00-00',-11013,'undeclared',-8513,'sinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'s','peloria\'s','14940','blushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblush','30550','11566',127,'00:00:00','worktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'swo','looker\'slooker\'slooker\'slooker\'slooker\'slooker\'slooker\'slooker\'slooker\'slooker\'s','5657-05-11',23094,'onerousness','bearer','censured','Shoemaker','mulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomul',5930,'ZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoust','1953-04-28 11:55:44','consulted','invalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinv',-27798,'carnauba\'s','Wilson',1963,NULL,'On\'s','leisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurely',NULL,-128,NULL,17674,'Queenstown\'s',-128,'convertors',1776,'576:20:59',NULL,'allegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriall','2097-10-02 08:41:26',31057,'AfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikaners','test1','0000-00-00 00:00:00','0000-00-00','backwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbac',NULL,NULL,'1932-10-01 18:49:04',12985,NULL,'leukocytes','603:54:26',-22488);
+INSERT INTO `table5` VALUES ('Frasquito\'s','unsatisfactory','jetted','00:00:00',NULL,'Merlin\'s',127,'0000-00-00 00:00:00',NULL,NULL,1998,'','decomposer','Commons',-14813,'oversimplification\'s',NULL,'-5368','','engirdengirdengirdengirdengirdengirdengirdengirdengird',-13627,14305,'frontally',127,'18421',-32295,NULL,NULL,'21841',NULL,'0000-00-00','cytology','2424-00-17',-30542,-17621,'octarchy\'s','outfoxed','00:00:00',27469,-128,'','Kamat\'s',-24130,-5948,'riband','Betsy',NULL,-18769,NULL,NULL,'Serafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSeraf',NULL,'disconcerting',NULL,'whirly','-20343','2020-07-01 12:09:36','','-26975','antiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticant',NULL,'ecumenically','utilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilize','1952-08-01 17:53:28','7903',-5633,'2024-03-17 13:46:59','-5474',127,'Malmö\'s',NULL,NULL,'0000-00-00','571:58:00',17287,'26711','alphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetize',-15158,2001,1997,'hobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithob','Campinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'s',-5693,'test1','3741','','Audrye\'s','monstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymo','00:00:00','test1','-21023',4693,'1998-01-06 04:41:40','Silastic\'s','0000-00-00 00:00:00','0000-00-00 00:00:00','Hedelman\'s',-30080,'normalization\'s','00:00:00',NULL,8197,NULL,NULL,NULL,'nudism\'s','2005-04-13 00:31:55',29046,'8992','11992',NULL,'-1685',-11453,'mythology\'s',26185,'Pyrenea','Pedrick\'s','0000-00-00',27436,'shots',NULL,'discordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscords','bayonet','-7217','scriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscripts',NULL,'17182',NULL,'628:49:55','nunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenuncle',NULL,'0000-00-00',-17444,'celestite\'s','Adars','Hispaniola','Mesopotamians','agglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutin',31998,'electrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistriesele','2005-09-09 23:41:06','bastinaded',NULL,-10763,'impetuosity\'s','xenogenesis\'s',1947,'-29913',NULL,'taxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomies',NULL,NULL,'internees',28697,'Kharkov\'s',NULL,'Swabia',18366,'00:00:00','delayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayer','circusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycir','2066-02-13 14:27:00',-28405,NULL,'test1','0000-00-00 00:00:00','0000-00-00','heterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotr','enchondromaenchondromaenchondromaenchondromaenchondromaenchondromaenchondromaenchondroma','AryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAry','2090-10-13 10:03:05',NULL,NULL,'Yucatan','285:37:51',7627);
+/*!40000 ALTER TABLE `table5` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+
+#explain select * from `table5` where (col2 <= '6566-06-15' AND col24 <> 'd') group by `col83` order by `col83` desc ;
+
+select * from `table5` where (col2 <= '6566-06-15' AND col24 <> 'd') group by `col83` order by `col83` desc ;
+
+drop table `table5`;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43101.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43101.test new file mode 100644 index 00000000000..7dd921806bf --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43101.test @@ -0,0 +1,41 @@ +# Test for BUG#43101 "MyISAM&Maria gives rows for <>NULL and >NULL +# with LIMIT clause" + +--source include/have_debug.inc + +# Goes away with +#set session debug=+d,optimizer_no_icp; + +CREATE TABLE t1(c1 TIME NOT NULL, c2 TIME NULL, c3 DATE, PRIMARY +KEY(c1), UNIQUE INDEX(c2)); + +insert into t1 values('-838:59:59','-838:59:59','2009-01-21'); +insert into t1 values('00:00:00','00:00:00','2009-01-09'); +insert into t1 values('00:00:11','00:00:11','2009-01-20'); +insert into t1 values('00:00:12','00:00:12','2009-01-13'); +insert into t1 values('00:00:45','00:00:45','2009-01-07'); +insert into t1 values('00:11:12','00:11:12','2009-01-19'); +insert into t1 values('00:12:30','00:12:30','2009-01-23'); +insert into t1 values('00:12:34','00:12:34','2009-01-14'); +insert into t1 values('01:23:00','01:23:00','2009-01-03'); +insert into t1 values('08:03:02','08:03:02','2009-01-18'); +insert into t1 values('08:29:45',NULL,'2009-02-01'); +insert into t1 values('09:00:45','09:00:45','2009-01-24'); +insert into t1 values('09:36:00','09:36:00','2009-01-25'); +insert into t1 values('10:00:00','10:00:00','2009-01-06'); +insert into t1 values('10:11:12','10:11:12','2009-01-11'); +insert into t1 values('10:22:33','10:22:33','2009-01-02'); +insert into t1 values('11:11:12','11:11:12','2009-01-12'); +insert into t1 values('11:11:27','11:11:27','2009-01-17'); +insert into t1 values('12:34:56','12:34:56','2009-01-01'); +insert into t1 values('12:34:58','12:34:58','2009-01-15'); +insert into t1 values('12:35:56','12:35:56','2009-01-16'); +insert into t1 values('491:22:33','491:22:33','2009-01-04'); +insert into t1 values('825:23:00','825:23:00','2009-01-05'); +insert into t1 values('838:59:59','838:59:59','2009-01-21'); + +SELECT * FROM t1 WHERE c2 <> NULL ORDER BY c2 DESC; + +SELECT * FROM t1 WHERE c2 <> NULL ORDER BY c2 DESC LIMIT 2; + +drop table t1; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43249.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43249.test new file mode 100644 index 00000000000..827220b0a6f --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43249.test @@ -0,0 +1,17 @@ +# Test for BUG#43249 "Innodb returns zero time for the time column +# with <=> NULL order by limit" + +--source include/have_debug.inc +--source include/have_innodb.inc + +set session debug="+d,optimizer_innodb_icp"; + +CREATE TABLE t1(c1 TIME NOT NULL, c2 TIME NULL, c3 DATE, PRIMARY +KEY(c1), UNIQUE INDEX(c2)) engine=innodb; +INSERT INTO t1 VALUES('8:29:45',NULL,'2009-02-01'); +# first time, good results: +SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c2 LIMIT 2; +# second time, bad results: +SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c2 LIMIT 2; + +drop table `t1`; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43360.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43360.test new file mode 100644 index 00000000000..0d1e4740712 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43360.test @@ -0,0 +1,44 @@ + +--echo # +--echo # Bug#43360 - Server crash with a simple multi-table update +--echo # + +--source include/have_debug.inc +--source include/have_innodb.inc + +# crash requires this +set session debug="+d,optimizer_innodb_icp"; + +CREATE TABLE t1 ( + a CHAR(2) NOT NULL PRIMARY KEY, + b VARCHAR(20) NOT NULL, + KEY (b) +) ENGINE=InnoDB; + +CREATE TABLE t2 ( + a CHAR(2) NOT NULL PRIMARY KEY, + b VARCHAR(20) NOT NULL, + KEY (b) +) ENGINE=InnoDB; + +INSERT INTO t1 VALUES +('AB','MySQLAB'), +('JA','Sun Microsystems'), +('MS','Microsoft'), +('IB','IBM- Inc.'), +('GO','Google Inc.'); + +INSERT INTO t2 VALUES +('AB','Sweden'), +('JA','USA'), +('MS','United States of America'), +('IB','North America'), +('GO','South America'); + +UPDATE t1,t2 SET t1.b=UPPER(t1.b) WHERE t1.b LIKE 'United%'; + +SELECT * FROM t1; + +SELECT * FROM t2; + +DROP TABLE t1,t2; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test new file mode 100644 index 00000000000..0daa1c3c739 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test @@ -0,0 +1,58 @@ +--echo # +--echo # Bug#43448 - Server crashes on multi table delete with Innodb +--echo # + +--source include/have_debug.inc +--source include/have_innodb.inc + +# crash requires ICP support in InnoDB +set session debug="+d,optimizer_innodb_icp"; + +CREATE TABLE t1 ( + id1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + t CHAR(12) +) ENGINE=InnoDB; + +CREATE TABLE t2 ( + id2 INT NOT NULL, + t CHAR(12) +) ENGINE=InnoDB; + +CREATE TABLE t3( + id3 INT NOT NULL, + t CHAR(12), + INDEX(id3) +) ENGINE=InnoDB; + +disable_query_log; + +let $1 = 100; +while ($1) +{ + let $2 = 5; + eval INSERT INTO t1(t) VALUES ('$1'); + while ($2) + { + eval INSERT INTO t2(id2,t) VALUES ($1,'$2'); + let $3 = 10; + while ($3) + { + eval INSERT INTO t3(id3,t) VALUES ($1,'$2'); + dec $3; + } + dec $2; + } + dec $1; +} + +enable_query_log; + +SELECT COUNT(*) FROM t1 WHERE id1 > 90; +SELECT COUNT(*) FROM t2 WHERE id2 > 90; +SELECT COUNT(*) FROM t3 WHERE id3 > 90; + +DELETE t1, t2, t3 +FROM t1, t2, t3 +WHERE t1.id1 = t2.id2 AND t2.id2 = t3.id3 AND t1.id1 > 5; + +DROP TABLE t1, t2, t3; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43617.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43617.test new file mode 100644 index 00000000000..6446ce36f5d --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43617.test @@ -0,0 +1,83 @@ +# test for BUG#43617 "Innodb returns wrong results with timestamp's +# range value in IN clause" +--source include/have_debug.inc +--source include/have_innodb.inc + +set storage_engine=innodb; + +set session debug="+d,optimizer_innodb_icp"; + +######## Running INSERT tests for TIMESTAMP ######## + +# Create tables +CREATE TABLE t1(c1 TIMESTAMP NOT NULL, c2 TIMESTAMP NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1), UNIQUE INDEX(c2)); + +# Insert some rows with targeted values + +# As a string in either 'YYYY-MM-DD HH:MM:SS', 'YY-MM-DD HH:MM:SS', 'YYYY-MM-DD' or 'YY-MM-DD' format +INSERT INTO t1 VALUES('98-12-31 11:30:45','98.12.31 11+30+45','98-12-31 11:30:45','98.12.31 11+30+45'),('98/12/30 11*30*45','98@12@30 11^30^45','98/12/30 11*30*45','98@12@30 11^30^45'),('98-12-29','98.12.29','98-12-29','98.12.29'),('98/12/28','98@12@28','98/12/28','98@12@28'); + +# As a string with no delimiters in either 'YYYYMMDDHHMMSS', 'YYMMDDHHMMSS', 'YYYYMMDD' or 'YYMMDD' format +INSERT INTO t1 VALUES('20070523091528','070523091528','20070524091528','070524091528'),('20070525','070525','20070526','070526'); + +# As a number in either YYYYMMDDHHMMSS, YYMMDDHHMMSS, YYYYMMDD or YYMMDD format +INSERT INTO t1 VALUES(19830905132800,830905132800,19830906132800,830906132800),(19830907,830907,19830908,830908); + +# As the result of a function +SET TIMESTAMP=1233216687; # 2009-01-29 13:41:27 +INSERT INTO t1 VALUES(NOW(),CURRENT_DATE,NOW(),CURRENT_DATE); + +# Insert permissible NULLs +INSERT INTO t1 VALUES('2008-01-01',NULL,'08-01-02','08/01/03'); + +# Insert duplicate NULLs to unique column +INSERT INTO t1(c1,c2) VALUES('08/01/17',NULL); +DELETE FROM t1 WHERE c1='08/01/17' AND c2 IS NULL; + +# Insert empty string '', would be converted to zero value of the appropriate type +INSERT INTO t1 VALUES('','','08-01-04','08/01/05') /* Inserts zero dates for '' strings */; + +--sorted_result +SELECT * FROM t1; + +# Test 'INSERT IGNORE' with the same rows that reported constraint violation above +# Ignore pk constraint +INSERT IGNORE INTO t1(c1,c2) VALUES('20070525','20070527') /* doesn't throw error */; + +# Ignore unique constraint +INSERT IGNORE INTO t1(c1,c2) VALUES(19840905,830907) /* doesn't throw error */; + +# Test 'INSERT ON DUPLICATE KEY UPDATE' with single column PK +SELECT * FROM t1 WHERE c1='20070527' /* Returns no rows */; +INSERT INTO t1(c1) VALUES('20070525') ON DUPLICATE KEY UPDATE c1='20070527'; +SELECT * FROM t1 WHERE c1='20070527' /* Returns 1 row with c1=2007-05-27 */; + +# Test 'INSERT ON DUPLICATE KEY UPDATE' with single column unique +SELECT * FROM t1 WHERE c1=19830909 AND c2=830910 /* Returns no rows */; +INSERT INTO t1(c1,c2) VALUES(19840905,830907) ON DUPLICATE KEY UPDATE c1=19830909,c2=830910; +SELECT * FROM t1 WHERE c1=19830909 AND c2=830910 /* Returns 1 row */; + +# Test 'INSERT SET' +INSERT INTO t1 SET c1='1999-01-01',c2='1999-01-01'; +SELECT * FROM t1 WHERE c1='1999-01-01' AND c2='1999-01-01' /* Returns 1 row with values for other column as NULL */; + +# Test insert range values to 'TIMESTAMP' columns +INSERT INTO t1 VALUES('1971-01-01 00:00:01','1980-01-01 00:00:01','2009-01-01','2009-01-02'),('1990-01-01 00:00:01','2000-01-01 00:00:01','2009-01-03','2009-01-04'),('2038-01-09 03:14:07','2038-01-09 03:14:07','2009-01-05','2009-01-06'); + +# Test insert NULL to non-null column +# Inserting NULL to TIMESTAMP NOT NULL field doesn't throw error, but records the current/set timestamp + +DELETE FROM t1 WHERE c1=NOW() /* because the row with current timestamp exists */; +INSERT INTO t1 VALUES(NULL,NOW(),NOW(),NOW()); +SELECT * FROM t1 WHERE c1 IS NULL /* returns no rows */; +SELECT * FROM t1 WHERE c1=NOW() /* returns 1 row */; + +--sorted_result +SELECT * FROM t1; + +SELECT * FROM t1 WHERE c2 IN ('1971-01-01 00:00:01','2038-01-09 03:14:07') ORDER BY c2; +SELECT * FROM t1 WHERE c2 IN ('1971-01-01 00:00:01','2038-01-09 03:14:07') ORDER BY c2 LIMIT 2; +SELECT * FROM t1 WHERE c2 IN ('1971-01-01 00:00:01','2038-01-09 03:14:07') ORDER BY c2 DESC; +SELECT * FROM t1 WHERE c2 IN ('1971-01-01 00:00:01','2038-01-09 03:14:07') ORDER BY c2 DESC LIMIT 2; +DROP TABLE t1; + diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43618.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43618.test new file mode 100644 index 00000000000..6a2b03b04aa --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43618.test @@ -0,0 +1,46 @@ +# test for BUG#43618 "MyISAM&Maria returns wrong results with +# 'between' on timestamp" + +--source include/have_debug.inc + +# bug goes away with +#set session debug="+d,optimizer_no_icp"; + +######## Running INSERT tests for TIMESTAMP ######## + +# Create tables +CREATE TABLE t1(c1 TIMESTAMP NOT NULL, c2 TIMESTAMP NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1), UNIQUE INDEX(c2)); + +# Insert some rows with targeted values + +# As a string in either 'YYYY-MM-DD HH:MM:SS', 'YY-MM-DD HH:MM:SS', 'YYYY-MM-DD' or 'YY-MM-DD' format +INSERT INTO t1 VALUES('98-12-31 11:30:45','98.12.31 11+30+45','98-12-31 11:30:45','98.12.31 11+30+45'),('98/12/30 11*30*45','98@12@30 11^30^45','98/12/30 11*30*45','98@12@30 11^30^45'),('98-12-29','98.12.29','98-12-29','98.12.29'),('98/12/28','98@12@28','98/12/28','98@12@28'); + +# As a string with no delimiters in either 'YYYYMMDDHHMMSS', 'YYMMDDHHMMSS', 'YYYYMMDD' or 'YYMMDD' format +INSERT INTO t1 VALUES('20070523091528','070523091528','20070524091528','070524091528'),('20070525','070525','20070526','070526'); + +# As a number in either YYYYMMDDHHMMSS, YYMMDDHHMMSS, YYYYMMDD or YYMMDD format +INSERT INTO t1 VALUES(19830905132800,830905132800,19830906132800,830906132800),(19830907,830907,19830908,830908); + +# As the result of a function +SET TIMESTAMP=1233216687; # 2009-01-29 13:41:27 +INSERT INTO t1 VALUES(NOW(),CURRENT_DATE,NOW(),CURRENT_DATE); + +# Insert permissible NULLs +INSERT INTO t1 VALUES('2008-01-01',NULL,'08-01-02','08/01/03'); + +# Insert duplicate NULLs to unique column +INSERT INTO t1(c1,c2) VALUES('08/01/17',NULL); +DELETE FROM t1 WHERE c1='08/01/17' AND c2 IS NULL; + +# Insert empty string '', would be converted to zero value of the appropriate type +INSERT INTO t1 VALUES('','','08-01-04','08/01/05') /* Inserts zero dates for '' strings */; + +INSERT INTO t1 VALUES('1971-01-01 00:00:01','1980-01-01 00:00:01','2009-01-01','2009-01-02'),('1990-01-01 00:00:01','2000-01-01 00:00:01','2009-01-03','2009-01-04'),('2038-01-09 03:14:07','2038-01-09 03:14:07','2009-01-05','2009-01-06'); + +--sorted_result +SELECT * FROM t1; +SELECT * FROM t1 WHERE c1 BETWEEN '0000-00-00' AND '2010-00-01 00:00:00' ORDER BY c1 DESC LIMIT 2; +SELECT * FROM t1 WHERE c2 BETWEEN '1971-01-01 00:00:01' AND '2010-10-00 00:00:00' ORDER BY c2 DESC LIMIT 2; +DROP TABLE t1; + diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug45219.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug45219.test new file mode 100644 index 00000000000..85e24824afc --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug45219.test @@ -0,0 +1,183 @@ +# BUG#45219 "Azalea crash on query containing a JOIN in subquery" + +# Both SELECT DISTINCT cause similar crashes. +# With ./mtr --mysqld=--optimizer_switch="semijoin=off" optimizer_unfixed_bugs.bug45219 +# there is no crash, the result file has been created with this +# command, but it has *not* been checked for correctness of returned +# data (at least 5.1 gives the same result). + + +# Begin test case for query 0 + +--disable_warnings +DROP TABLE IF EXISTS CC, C, BB; +--enable_warnings + +CREATE TABLE `CC` ( + `pk` int(11) NOT NULL AUTO_INCREMENT, + `int_nokey` int(11) NOT NULL, + `datetime_key` datetime NOT NULL, + `varchar_key` varchar(1) NOT NULL, + PRIMARY KEY (`pk`), + KEY `datetime_key` (`datetime_key`), + KEY `varchar_key` (`varchar_key`) +) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1; +INSERT INTO `CC` VALUES +(10,0,'2006-07-07 07:26:28','q'),(11,5,'2002-09-23 00:00:00','m'), +(12,7,'0000-00-00 00:00:00','j'),(13,1,'2006-06-07 00:00:00','z'), +(14,8,'2000-09-16 12:15:34','a'),(15,2,'2007-08-05 15:47:52',''), +(16,1,'0000-00-00 00:00:00','e'),(17,8,'2005-12-02 19:34:26','t'), +(18,5,'0000-00-00 00:00:00','q'),(19,4,'0000-00-00 00:00:00','b'), +(20,5,'2007-12-28 00:00:00','w'),(21,3,'2004-08-02 11:48:43','m'), +(22,0,'0000-00-00 00:00:00','x'),(23,8,'2004-04-19 12:18:43',''), +(24,0,'2009-04-27 00:00:00','w'),(25,4,'2006-10-20 14:52:15','x'), +(26,0,'0000-00-00 00:00:00','e'),(27,0,'2002-03-22 11:48:37','e'), +(28,2,'0000-00-00 00:00:00','p'),(29,0,'2001-01-04 03:55:07','x'); +CREATE TABLE `C` ( + `pk` int(11) NOT NULL AUTO_INCREMENT, + `int_nokey` int(11) NOT NULL, + `datetime_key` datetime NOT NULL, + `varchar_key` varchar(1) NOT NULL, + PRIMARY KEY (`pk`), + KEY `datetime_key` (`datetime_key`), + KEY `varchar_key` (`varchar_key`) +) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1; +INSERT INTO `C` VALUES +(1,9,'0000-00-00 00:00:00','p'),(2,0,'2002-02-09 07:38:13','v'), +(3,8,'2001-05-03 12:08:14','t'),(4,3,'0000-00-00 00:00:00','u'), +(5,7,'2009-07-28 03:43:30','n'),(6,0,'2009-08-04 00:00:00','l'), +(7,1,'0000-00-00 00:00:00','h'),(8,9,'0000-00-00 00:00:00','u'), +(9,0,'2005-08-02 17:16:54','n'),(10,9,'2002-12-21 00:00:00','j'), +(11,0,'2005-08-15 12:37:35','k'),(12,5,'0000-00-00 00:00:00','e'), +(13,0,'2006-03-10 00:00:00','i'),(14,8,'2005-05-16 11:02:36','u'), +(15,8,'2008-11-02 00:00:00','n'),(16,5,'2006-03-15 00:00:00','b'), +(17,1,'0000-00-00 00:00:00','x'),(18,7,'0000-00-00 00:00:00',''), +(19,0,'2008-12-17 20:15:40','q'),(20,9,'0000-00-00 00:00:00','u'); +CREATE TABLE `BB` ( + `pk` int(11) NOT NULL AUTO_INCREMENT, + `int_nokey` int(11) NOT NULL, + `datetime_key` datetime NOT NULL, + `varchar_key` varchar(1) NOT NULL, + PRIMARY KEY (`pk`), + KEY `datetime_key` (`datetime_key`), + KEY `varchar_key` (`varchar_key`) +) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=latin1; +INSERT INTO `BB` VALUES +(10,8,'2007-08-19 08:08:38','i'),(11,0,'2000-05-21 03:51:51',''); + +SELECT DISTINCT `datetime_key` +FROM C +WHERE ( `int_nokey` , `pk` ) IN ( +SELECT INNR .`pk` , INNR .`pk` +FROM CC LEFT JOIN BB INNR ON INNR .`varchar_key` ) AND `pk` = 9 ; + +DROP TABLE CC, C, BB; + +# End of test case for query 0 + +# Begin test case for query 1 + +--disable_warnings +DROP TABLE IF EXISTS CC, C, BB; +--enable_warnings + +CREATE TABLE `CC` ( + `pk` int(11) NOT NULL AUTO_INCREMENT, + `int_nokey` int(11) NOT NULL, + `int_key` int(11) NOT NULL, + `date_key` date NOT NULL, + `datetime_key` datetime NOT NULL, + `varchar_key` varchar(1) NOT NULL, + `varchar_nokey` varchar(1) NOT NULL, + PRIMARY KEY (`pk`), + KEY `int_key` (`int_key`), + KEY `date_key` (`date_key`), + KEY `datetime_key` (`datetime_key`), + KEY `varchar_key` (`varchar_key`) +) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1; +INSERT INTO `CC` VALUES +(10,0,8,'2007-02-14','2006-07-07 07:26:28','q','q'), +(11,5,8,'2002-10-03','2002-09-23 00:00:00','m','m'), +(12,7,3,'2006-12-02','0000-00-00 00:00:00','j','j'), +(13,1,2,'2007-05-02','2006-06-07 00:00:00','z','z'), +(14,8,2,'2001-11-18','2000-09-16 12:15:34','a','a'), +(15,2,6,'2006-09-09','2007-08-05 15:47:52','',''), +(16,1,8,'0000-00-00','0000-00-00 00:00:00','e','e'), +(17,8,9,'2003-07-22','2005-12-02 19:34:26','t','t'), +(18,5,2,'2001-12-22','0000-00-00 00:00:00','q','q'), +(19,4,6,'0000-00-00','0000-00-00 00:00:00','b','b'), +(20,5,5,'2006-09-02','2007-12-28 00:00:00','w','w'), +(21,3,2,'0000-00-00','2004-08-02 11:48:43','m','m'), +(22,0,4,'0000-00-00','0000-00-00 00:00:00','x','x'), +(23,8,9,'2001-02-28','2004-04-19 12:18:43','',''), +(24,0,6,'0000-00-00','2009-04-27 00:00:00','w','w'), +(25,4,5,'2007-05-19','2006-10-20 14:52:15','x','x'), +(26,0,0,'2005-02-15','0000-00-00 00:00:00','e','e'), +(27,0,0,'2000-10-19','2002-03-22 11:48:37','e','e'), +(28,2,8,'2005-07-07','0000-00-00 00:00:00','p','p'), +(29,0,0,'2008-10-18','2001-01-04 03:55:07','x','x'); +CREATE TABLE `C` ( + `pk` int(11) NOT NULL AUTO_INCREMENT, + `int_nokey` int(11) NOT NULL, + `int_key` int(11) NOT NULL, + `date_key` date NOT NULL, + `datetime_key` datetime NOT NULL, + `varchar_key` varchar(1) NOT NULL, + `varchar_nokey` varchar(1) NOT NULL, + PRIMARY KEY (`pk`), + KEY `int_key` (`int_key`), + KEY `date_key` (`date_key`), + KEY `datetime_key` (`datetime_key`), + KEY `varchar_key` (`varchar_key`) +) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1; +INSERT INTO `C` VALUES +(1,9,9,'2007-12-01','0000-00-00 00:00:00','p','p'), +(2,0,0,'0000-00-00','2002-02-09 07:38:13','v','v'), +(3,8,6,'0000-00-00','2001-05-03 12:08:14','t','t'), +(4,3,6,'2002-05-07','0000-00-00 00:00:00','u','u'), +(5,7,6,'0000-00-00','2009-07-28 03:43:30','n','n'), +(6,0,4,'0000-00-00','2009-08-04 00:00:00','l','l'), +(7,1,7,'0000-00-00','0000-00-00 00:00:00','h','h'), +(8,9,4,'0000-00-00','0000-00-00 00:00:00','u','u'), +(9,0,8,'0000-00-00','2005-08-02 17:16:54','n','n'), +(10,9,4,'2000-12-18','2002-12-21 00:00:00','j','j'), +(11,0,7,'2005-11-13','2005-08-15 12:37:35','k','k'), +(12,5,5,'0000-00-00','0000-00-00 00:00:00','e','e'), +(13,0,0,'2003-11-12','2006-03-10 00:00:00','i','i'), +(14,8,5,'2006-02-20','2005-05-16 11:02:36','u','u'), +(15,8,7,'2005-02-12','2008-11-02 00:00:00','n','n'), +(16,5,2,'2009-07-20','2006-03-15 00:00:00','b','b'), +(17,1,8,'2005-02-24','0000-00-00 00:00:00','x','x'), +(18,7,0,'0000-00-00','0000-00-00 00:00:00','',''), +(19,0,9,'0000-00-00','2008-12-17 20:15:40','q','q'), +(20,9,5,'0000-00-00','0000-00-00 00:00:00','u','u'); +CREATE TABLE `BB` ( + `pk` int(11) NOT NULL AUTO_INCREMENT, + `int_nokey` int(11) NOT NULL, + `int_key` int(11) NOT NULL, + `date_key` date NOT NULL, + `datetime_key` datetime NOT NULL, + `varchar_key` varchar(1) NOT NULL, + `varchar_nokey` varchar(1) NOT NULL, + PRIMARY KEY (`pk`), + KEY `int_key` (`int_key`), + KEY `date_key` (`date_key`), + KEY `datetime_key` (`datetime_key`), + KEY `varchar_key` (`varchar_key`) +) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=latin1; +INSERT INTO `BB` VALUES (10,8,5,'0000-00-00','2007-08-19 +08:08:38','i','i'),(11,0,8,'2005-08-18','2000-05-21 03:51:51','',''); + +SELECT DISTINCT BIT_AND( OUTR . `datetime_key` ) AS X +FROM C AS OUTR +WHERE ( OUTR . `int_nokey` , OUTR . `pk` ) IN ( +SELECT DISTINCT INNR . `pk` AS X , INNR . `pk` AS Y +FROM CC AS INNR2 LEFT JOIN BB AS INNR ON +( INNR2 . `varchar_nokey` = INNR . `varchar_key` ) +WHERE INNR . `date_key` BETWEEN '2009-04-26' AND '2004-08-21' ) +AND OUTR . `pk` = 9 +ORDER BY OUTR . `int_key` , OUTR . `pk`; + +DROP TABLE CC, C, BB; + +# End of test case for query 1 diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug45221.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug45221.test new file mode 100644 index 00000000000..e60c7818b19 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug45221.test @@ -0,0 +1,97 @@ +# test for BUG#45221 "Query "SELECT pk FROM C WHERE pk IN (SELECT +# int_key)" failing" + +--source include/have_debug.inc + +# bug goes away with +#set session debug="+d,optimizer_no_icp"; + +# those don't remove the problem but make the result diff different: +#set optimizer_switch="materialization=off"; +#set optimizer_switch="semijoin=off"; +#set optimizer_switch="materialization=off,semijoin=off"; + +#/* Begin test case for query 0 */ + +CREATE TABLE `CC` ( + `pk` int(11) NOT NULL AUTO_INCREMENT, + `int_key` int(11) DEFAULT NULL, + `date_nokey` date DEFAULT NULL, + `datetime_nokey` datetime DEFAULT NULL, + PRIMARY KEY (`pk`), + KEY `int_key` (`int_key`), + KEY `varchar_key` (`int_key`) +) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1; +INSERT INTO `CC` VALUES (10,8,NULL,'2002-02-26 06:14:37'),(11,9,'2006-06-14','1900-01-01 00:00:00'),(12,9,'2002-09-12','2006-12-03 09:37:26'),(13,186,'2005-02-15','2008-05-26 12:27:10'),(14,NULL,NULL,'2004-12-14 16:37:30'),(15,2,'2008-11-04','2003-02-11 21:19:41'),(16,3,'2004-09-04','2009-10-18 02:27:49'),(17,0,'2006-06-05','2000-09-26 07:45:57'),(18,133,'1900-01-01',NULL),(19,1,'1900-01-01','2005-11-10 12:40:29'),(20,8,'1900-01-01','2009-04-25 00:00:00'),(21,5,'2005-01-13','2002-11-27 00:00:00'),(22,5,'2006-05-21','2004-01-26 20:32:32'),(23,8,'2003-09-08','2007-10-26 11:41:40'),(24,6,'2006-12-23','2005-10-07 00:00:00'),(25,51,'2006-10-15','2000-07-15 05:00:34'),(26,4,'2005-04-06','2000-04-03 16:33:32'),(27,7,'2008-04-07',NULL),(28,6,'2006-10-10','2001-04-25 01:26:12'),(29,4,'1900-01-01','2000-12-27 00:00:00'); +CREATE TABLE `C` ( + `pk` int(11) NOT NULL AUTO_INCREMENT, + `int_key` int(11) DEFAULT NULL, + `date_nokey` date DEFAULT NULL, + `datetime_nokey` datetime DEFAULT NULL, + PRIMARY KEY (`pk`), + KEY `int_key` (`int_key`), + KEY `varchar_key` (`int_key`) +) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1; +INSERT INTO `C` VALUES (1,2,NULL,'2004-10-11 18:13:16'),(2,9,'2001-09-19',NULL),(3,3,'2004-09-12','1900-01-01 00:00:00'),(4,9,NULL,'2009-07-25 00:00:00'),(5,NULL,'2002-07-19',NULL),(6,9,'2002-12-16','2008-07-27 00:00:00'),(7,3,'2006-02-08','2002-11-13 16:37:31'),(8,8,'2006-08-28','1900-01-01 00:00:00'),(9,8,'2001-04-14','2003-12-10 00:00:00'),(10,53,'2000-01-05','2001-12-21 22:38:22'),(11,0,'2003-12-06','2008-12-13 23:16:44'),(12,5,'1900-01-01','2005-08-15 12:39:41'),(13,166,'2002-11-27',NULL),(14,3,NULL,'2006-09-11 12:06:14'),(15,0,'2003-05-27','2007-12-15 12:39:34'),(16,1,'2005-05-03','2005-08-09 00:00:00'),(17,9,'2001-04-18','2001-09-02 22:50:02'),(18,5,'2005-12-27','2005-12-16 22:58:11'),(19,6,'2004-08-20','2007-04-19 00:19:53'),(20,2,'1900-01-01','1900-01-01 00:00:00'); + +SELECT `pk` +FROM C OUTR +WHERE `pk` IN ( +SELECT `int_key` +FROM CC +WHERE `date_nokey` < `datetime_nokey` XOR OUTR .`date_nokey` ) ; + +SELECT `pk` +FROM C +WHERE `pk` IN ( +SELECT `int_key` +FROM CC +WHERE `date_nokey` < `datetime_nokey` XOR '2009-11-25' ) ; + +DROP TABLE CC; +DROP TABLE C; +#/* End of test case for query 0 */ + +#/* Begin test case for query 1 */ + +CREATE TABLE `CC` ( + `pk` int(11) NOT NULL AUTO_INCREMENT, + `int_nokey` int(11) DEFAULT NULL, + `int_key` int(11) DEFAULT NULL, + `date_nokey` date DEFAULT NULL, + `datetime_key` datetime DEFAULT NULL, + `datetime_nokey` datetime DEFAULT NULL, + PRIMARY KEY (`pk`), + KEY `int_key` (`int_key`), + KEY `datetime_key` (`datetime_key`), + KEY `varchar_key` (`int_key`) +) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1; +INSERT INTO `CC` VALUES (10,7,8,NULL,'2002-02-26 06:14:37','2002-02-26 06:14:37'),(11,1,9,'2006-06-14','1900-01-01 00:00:00','1900-01-01 00:00:00'),(12,5,9,'2002-09-12','2006-12-03 09:37:26','2006-12-03 09:37:26'),(13,3,186,'2005-02-15','2008-05-26 12:27:10','2008-05-26 12:27:10'),(14,6,NULL,NULL,'2004-12-14 16:37:30','2004-12-14 16:37:30'),(15,92,2,'2008-11-04','2003-02-11 21:19:41','2003-02-11 21:19:41'),(16,7,3,'2004-09-04','2009-10-18 02:27:49','2009-10-18 02:27:49'),(17,NULL,0,'2006-06-05','2000-09-26 07:45:57','2000-09-26 07:45:57'),(18,3,133,'1900-01-01',NULL,NULL),(19,5,1,'1900-01-01','2005-11-10 12:40:29','2005-11-10 12:40:29'),(20,1,8,'1900-01-01','2009-04-25 00:00:00','2009-04-25 00:00:00'),(21,2,5,'2005-01-13','2002-11-27 00:00:00','2002-11-27 00:00:00'),(22,NULL,5,'2006-05-21','2004-01-26 20:32:32','2004-01-26 20:32:32'),(23,1,8,'2003-09-08','2007-10-26 11:41:40','2007-10-26 11:41:40'),(24,0,6,'2006-12-23','2005-10-07 00:00:00','2005-10-07 00:00:00'),(25,210,51,'2006-10-15','2000-07-15 05:00:34','2000-07-15 05:00:34'),(26,8,4,'2005-04-06','2000-04-03 16:33:32','2000-04-03 16:33:32'),(27,7,7,'2008-04-07',NULL,NULL),(28,5,6,'2006-10-10','2001-04-25 01:26:12','2001-04-25 01:26:12'),(29,NULL,4,'1900-01-01','2000-12-27 00:00:00','2000-12-27 00:00:00'); +CREATE TABLE `C` ( + `pk` int(11) NOT NULL AUTO_INCREMENT, + `int_nokey` int(11) DEFAULT NULL, + `int_key` int(11) DEFAULT NULL, + `date_nokey` date DEFAULT NULL, + `datetime_key` datetime DEFAULT NULL, + `datetime_nokey` datetime DEFAULT NULL, + PRIMARY KEY (`pk`), + KEY `int_key` (`int_key`), + KEY `datetime_key` (`datetime_key`), + KEY `varchar_key` (`int_key`) +) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1; +INSERT INTO `C` VALUES (1,NULL,2,NULL,'2004-10-11 18:13:16','2004-10-11 18:13:16'),(2,7,9,'2001-09-19',NULL,NULL),(3,9,3,'2004-09-12','1900-01-01 00:00:00','1900-01-01 00:00:00'),(4,7,9,NULL,'2009-07-25 00:00:00','2009-07-25 00:00:00'),(5,4,NULL,'2002-07-19',NULL,NULL),(6,2,9,'2002-12-16','2008-07-27 00:00:00','2008-07-27 00:00:00'),(7,6,3,'2006-02-08','2002-11-13 16:37:31','2002-11-13 16:37:31'),(8,8,8,'2006-08-28','1900-01-01 00:00:00','1900-01-01 00:00:00'),(9,NULL,8,'2001-04-14','2003-12-10 00:00:00','2003-12-10 00:00:00'),(10,5,53,'2000-01-05','2001-12-21 22:38:22','2001-12-21 22:38:22'),(11,NULL,0,'2003-12-06','2008-12-13 23:16:44','2008-12-13 23:16:44'),(12,6,5,'1900-01-01','2005-08-15 12:39:41','2005-08-15 12:39:41'),(13,188,166,'2002-11-27',NULL,NULL),(14,2,3,NULL,'2006-09-11 12:06:14','2006-09-11 12:06:14'),(15,1,0,'2003-05-27','2007-12-15 12:39:34','2007-12-15 12:39:34'),(16,1,1,'2005-05-03','2005-08-09 00:00:00','2005-08-09 00:00:00'),(17,0,9,'2001-04-18','2001-09-02 22:50:02','2001-09-02 22:50:02'),(18,9,5,'2005-12-27','2005-12-16 22:58:11','2005-12-16 22:58:11'),(19,NULL,6,'2004-08-20','2007-04-19 00:19:53','2007-04-19 00:19:53'),(20,4,2,'1900-01-01','1900-01-01 00:00:00','1900-01-01 00:00:00'); + +SELECT OUTR . `pk` AS X +FROM C AS OUTR +WHERE OUTR . `pk` IN ( +SELECT INNR . `int_key` AS Y +FROM CC AS INNR +WHERE INNR . `date_nokey` < INNR . `datetime_nokey` XOR OUTR . `date_nokey` BETWEEN '2004-07-10' AND '2009-11-25' +ORDER BY INNR . `int_nokey` ) AND ( OUTR . `datetime_key` BETWEEN '2000-05-25' AND '2004-08-07' OR OUTR . `datetime_nokey` = '2007-10-24' ) +ORDER BY OUTR . `int_key` , OUTR . `pk`; + + +DROP TABLE CC; +DROP TABLE C; +#/* End of test case for query 1 */ + diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug49129.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug49129.test new file mode 100644 index 00000000000..e0e7179afa1 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug49129.test @@ -0,0 +1,34 @@ +SET SESSION optimizer_switch = 'firstmatch=off,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on'; + +CREATE TABLE t0 (a INT); +INSERT INTO t0 VALUES (0),(1),(2),(3),(4); + +CREATE TABLE t1 (a INT, b INT, KEY(a)); +INSERT INTO t1 SELECT a, a from t0; + +CREATE TABLE t2 (a INT, b INT, PRIMARY KEY(a)); +INSERT INTO t2 SELECT * FROM t1; + +UPDATE t1 SET a=3, b=11 WHERE a=4; +UPDATE t2 SET b=11 WHERE a=3; + +--echo +--echo # This result is wrong, but will be fixed by Bug#46556 +SELECT * FROM t0 WHERE t0.a IN + (SELECT t1.a FROM t1, t2 WHERE t2.a=t0.a AND t1.b=t2.b); + +SET join_cache_level = 6; + +--echo +--echo # This result is even more wrong ;-) +SELECT * FROM t0 WHERE t0.a IN + (SELECT t1.a FROM t1, t2 WHERE t2.a=t0.a AND t1.b=t2.b); + +SET SESSION optimizer_switch = 'semijoin=off'; + +--echo +--echo # This result is correct +SELECT * FROM t0 WHERE t0.a IN + (SELECT t1.a FROM t1, t2 WHERE t2.a=t0.a AND t1.b=t2.b); + +DROP TABLE t0, t1, t2; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/disabled.def b/mysql-test/suite/optimizer_unfixed_bugs/t/disabled.def new file mode 100644 index 00000000000..4aaca8adc09 --- /dev/null +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/disabled.def @@ -0,0 +1,7 @@ +# Disabling all subquery problems + +bug49129 : Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off +bug45221 : Query "SELECT pk FROM C WHERE pk IN (SELECT # int_key)" failing +bug45219 : Azalea crash on query containing a JOIN in subquery + + diff --git a/mysql-test/t/innodb_mrr.test b/mysql-test/t/innodb_mrr.test new file mode 100644 index 00000000000..e518695d14e --- /dev/null +++ b/mysql-test/t/innodb_mrr.test @@ -0,0 +1,124 @@ +-- source include/have_innodb.inc + +--disable_warnings +drop table if exists t1,t2,t3,t4; +--enable_warnings + +set @save_storage_engine= @@storage_engine; +set storage_engine=InnoDB; + +--source include/mrr_tests.inc + +set storage_engine= @save_storage_engine; + +# Try big rowid sizes +set @read_rnd_buffer_size_save= @@read_rnd_buffer_size; +set read_rnd_buffer_size=64; + +# By default InnoDB will fill values only for key parts used by the query, +# which will cause DS-MRR to supply an invalid tuple on scan restoration. +# Verify that DS-MRR's code extra(HA_EXTRA_RETRIEVE_ALL_COLS) call has effect: +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2(a char(8), b char(8), c char(8), filler char(100), key(a,b,c) ) engine=InnoDB; + +insert into t2 select + concat('a-', 1000 + A.a, '-a'), + concat('b-', 1000 + B.a, '-b'), + concat('c-', 1000 + C.a, '-c'), + 'filler' +from t1 A, t1 B, t1 C; + +explain +select count(length(a) + length(filler)) from t2 where a>='a-1000-a' and a <'a-1001-a'; +select count(length(a) + length(filler)) from t2 where a>='a-1000-a' and a <'a-1001-a'; +drop table t2; + +# Try a very big rowid +create table t2 (a char(100), b char(100), c char(100), d int, + filler char(10), key(d), primary key (a,b,c)) engine= innodb; +insert into t2 select A.a, B.a, B.a, A.a, 'filler' from t1 A, t1 B; +explain select * from t2 force index (d) where d < 10; +drop table t2; + +drop table t1; +set @@read_rnd_buffer_size= @read_rnd_buffer_size_save; + +# +# BUG#33033 "MySQL/InnoDB crashes with simple select range query" +# +create table t1 (f1 int not null, f2 int not null,f3 int not null, f4 char(1), primary key (f1,f2), key ix(f3))Engine=InnoDB; + +--disable_query_log +let $1=55; + +while ($1) +{ + eval insert into t1(f1,f2,f3,f4) values ($1,$1,$1,'A'); + dec $1; +} +--enable_query_log + +# The following must not crash: +select * from t1 where (f3>=5 and f3<=10) or (f3>=1 and f3<=4); + +drop table t1; + +--echo +--echo BUG#37977: Wrong result returned on GROUP BY + OR + Innodb +--echo +CREATE TABLE t1 ( + `pk` int(11) NOT NULL AUTO_INCREMENT, + `int_nokey` int(11) NOT NULL, + `int_key` int(11) NOT NULL, + `date_key` date NOT NULL, + `date_nokey` date NOT NULL, + `time_key` time NOT NULL, + `time_nokey` time NOT NULL, + `datetime_key` datetime NOT NULL, + `datetime_nokey` datetime NOT NULL, + `varchar_key` varchar(5) DEFAULT NULL, + `varchar_nokey` varchar(5) DEFAULT NULL, + PRIMARY KEY (`pk`), + KEY `int_key` (`int_key`), + KEY `date_key` (`date_key`), + KEY `time_key` (`time_key`), + KEY `datetime_key` (`datetime_key`), + KEY `varchar_key` (`varchar_key`) +) ENGINE=InnoDB; + +INSERT INTO t1 VALUES +(1,5,5,'2009-10-16','2009-10-16','09:28:15','09:28:15','2007-09-14 05:34:08','2007-09-14 05:34:08','qk','qk'), +(2,6,6,'0000-00-00','0000-00-00','23:06:39','23:06:39','0000-00-00 00:00:00','0000-00-00 00:00:00','j','j'), +(3,10,10,'2000-12-18','2000-12-18','22:16:19','22:16:19','2006-11-04 15:42:50','2006-11-04 15:42:50','aew','aew'), +(4,0,0,'2001-09-18','2001-09-18','00:00:00','00:00:00','2004-03-23 13:23:35','2004-03-23 13:23:35',NULL,NULL), +(5,6,6,'2007-08-16','2007-08-16','22:13:38','22:13:38','2004-08-19 11:01:28','2004-08-19 11:01:28','qu','qu'); +select pk from t1 WHERE `varchar_key` > 'kr' group by pk; +select pk from t1 WHERE `int_nokey` IS NULL OR `varchar_key` > 'kr' group by pk; +drop table t1; + +--echo # +--echo # BUG#39447: Error with NOT NULL condition and LIMIT 1 +--echo # +CREATE TABLE t1 ( + id int(11) NOT NULL, + parent_id int(11) DEFAULT NULL, + name varchar(10) DEFAULT NULL, + PRIMARY KEY (id), + KEY ind_parent_id (parent_id) +) ENGINE=InnoDB; + +insert into t1 (id, parent_id, name) values +(10,NULL,'A'), +(20,10,'B'), +(30,10,'C'), +(40,NULL,'D'), +(50,40,'E'), +(60,40,'F'), +(70,NULL,'J'); + +SELECT id FROM t1 WHERE parent_id IS NOT NULL ORDER BY id DESC LIMIT 1; +--echo This must show type=index, extra=Using where +explain SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE parent_id IS NOT NULL ORDER BY id DESC LIMIT 1; +SELECT * FROM t1 WHERE parent_id IS NOT NULL ORDER BY id DESC LIMIT 1; +drop table t1; diff --git a/mysql-test/t/myisam_mrr.test b/mysql-test/t/myisam_mrr.test new file mode 100644 index 00000000000..57616a8bc7c --- /dev/null +++ b/mysql-test/t/myisam_mrr.test @@ -0,0 +1,99 @@ +# +# MRR/MyISAM tests. +# + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +set @read_rnd_buffer_size_save= @@read_rnd_buffer_size; +set read_rnd_buffer_size=79; +select @@read_rnd_buffer_size; + +-- source include/mrr_tests.inc + +set @@read_rnd_buffer_size= @read_rnd_buffer_size_save; + +# +# BUG#30622: Incorrect query results for MRR + filesort +# +CREATE TABLE t1 ( + ID int(10) unsigned NOT NULL AUTO_INCREMENT, + col1 int(10) unsigned DEFAULT NULL, + key1 int(10) unsigned NOT NULL DEFAULT '0', + key2 int(10) unsigned DEFAULT NULL, + text1 text, + text2 text, + col2 smallint(6) DEFAULT '100', + col3 enum('headers','bodyandsubject') NOT NULL DEFAULT 'bodyandsubject', + col4 tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (ID), + KEY (key1), + KEY (key2) +) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; + +INSERT INTO t1 VALUES +(1,NULL,1130,NULL,'Hello',NULL,100,'bodyandsubject',0), +(2,NULL,1130,NULL,'bye',NULL,100,'bodyandsubject',0), +(3,NULL,1130,NULL,'red',NULL,100,'bodyandsubject',0), +(4,NULL,1130,NULL,'yellow',NULL,100,'bodyandsubject',0), +(5,NULL,1130,NULL,'blue',NULL,100,'bodyandsubject',0); + +select * FROM t1 WHERE key1=1130 AND col1 IS NULL ORDER BY text1; + +drop table t1; + + +--echo +--echo BUG#37851: Crash in test_if_skip_sort_order tab->select is zero +--echo +CREATE TABLE t1 ( + pk int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (pk) +); +INSERT INTO t1 VALUES (1); + +CREATE TABLE t2 ( + pk int(11) NOT NULL AUTO_INCREMENT, + int_key int(11) DEFAULT NULL, + PRIMARY KEY (pk), + KEY int_key (int_key) +); +INSERT INTO t2 VALUES (1,1),(2,6),(3,0); + +EXPLAIN EXTENDED +SELECT MIN(t1.pk) +FROM t1 WHERE EXISTS ( + SELECT t2.pk + FROM t2 + WHERE t2.int_key IS NULL + GROUP BY t2.pk +); + +DROP TABLE t1, t2; + +-- echo # +-- echo # BUG#42048 Discrepancy between MyISAM and Maria's ICP implementation +-- echo # +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (a int, b char(20), filler char(200), key(a,b(10))); +insert into t1 select A.a + 10*(B.a + 10*C.a), 'bbb','filler' from t0 A, t0 B, t0 C; +update t1 set b=repeat(char(65+a), 20) where a < 25; + +--echo This must show range + using index condition: +explain select * from t1 where a < 10 and b = repeat(char(65+a), 20); +select * from t1 where a < 10 and b = repeat(char(65+a), 20); +drop table t0,t1; + +-- echo # +-- echo # BUG#41136: ORDER BY + range access: EXPLAIN shows "Using MRR" while MRR is actually not used +-- echo # +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (a int, b int, key(a)); +insert into t1 select A.a + 10 *(B.a + 10*C.a), A.a + 10 *(B.a + 10*C.a) from t0 A, t0 B, t0 C; +-- echo This mustn't show "Using MRR": +explain select * from t1 where a < 20 order by a; +drop table t0, t1; + diff --git a/sql/Makefile.am b/sql/Makefile.am index 00342f7034e..b2972072866 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -47,7 +47,7 @@ mysqld_LDADD = libndb.la \ $(LDADD) $(CXXLDFLAGS) $(WRAPLIBS) @LIBDL@ \ $(yassl_libs) $(openssl_libs) @MYSQLD_EXTRA_LIBS@ -noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ +noinst_HEADERS = ds_mrr.h item.h item_func.h item_sum.h item_cmpfunc.h \ item_strfunc.h item_timefunc.h \ item_xmlfunc.h \ item_create.h item_subselect.h item_row.h \ @@ -79,7 +79,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ sql_partition.h partition_info.h partition_element.h \ contributors.h sql_servers.h -mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ +mysqld_SOURCES = ds_mrr.cc sql_lex.cc sql_handler.cc sql_partition.cc \ item.cc item_sum.cc item_buff.cc item_func.cc \ item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \ thr_malloc.cc item_create.cc item_subselect.cc \ diff --git a/sql/ds_mrr.cc b/sql/ds_mrr.cc new file mode 100644 index 00000000000..7a0fc65b8f5 --- /dev/null +++ b/sql/ds_mrr.cc @@ -0,0 +1,1333 @@ +#include "mysql_priv.h" +#include "sql_select.h" + +/* ************************************************************************** + * DS-MRR implementation + ***************************************************************************/ + +/** + DS-MRR: Initialize and start MRR scan + + Initialize and start the MRR scan. Depending on the mode parameter, this + may use default or DS-MRR implementation. + + @param h Table handler to be used + @param key Index to be used + @param seq_funcs Interval sequence enumeration functions + @param seq_init_param Interval sequence enumeration parameter + @param n_ranges Number of ranges in the sequence. + @param mode HA_MRR_* modes to use + @param buf INOUT Buffer to use + + @retval 0 Ok, Scan started. + @retval other Error +*/ + +int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs, + void *seq_init_param, uint n_ranges, uint mode, + HANDLER_BUFFER *buf) +{ + uint elem_size; + Item *pushed_cond= NULL; + handler *new_h2= 0; + DBUG_ENTER("DsMrr_impl::dsmrr_init"); + + /* + index_merge may invoke a scan on an object for which dsmrr_info[_const] + has not been called, so set the owner handler here as well. + */ + h= h_arg; + if (mode & HA_MRR_USE_DEFAULT_IMPL || mode & HA_MRR_SORTED) + { + use_default_impl= TRUE; + const int retval= + h->handler::multi_range_read_init(seq_funcs, seq_init_param, + n_ranges, mode, buf); + DBUG_RETURN(retval); + } + rowids_buf= buf->buffer; + + is_mrr_assoc= !test(mode & HA_MRR_NO_ASSOCIATION); + + if (is_mrr_assoc) + status_var_increment(table->in_use->status_var.ha_multi_range_read_init_count); + + rowids_buf_end= buf->buffer_end; + elem_size= h->ref_length + (int)is_mrr_assoc * sizeof(void*); + rowids_buf_last= rowids_buf + + ((rowids_buf_end - rowids_buf)/ elem_size)* + elem_size; + rowids_buf_end= rowids_buf_last; + + /* + There can be two cases: + - This is the first call since index_init(), h2==NULL + Need to setup h2 then. + - This is not the first call, h2 is initalized and set up appropriately. + The caller might have called h->index_init(), need to switch h to + rnd_pos calls. + */ + if (!h2) + { + /* Create a separate handler object to do rndpos() calls. */ + THD *thd= current_thd; + /* + ::clone() takes up a lot of stack, especially on 64 bit platforms. + The constant 5 is an empiric result. + */ + if (check_stack_overrun(thd, 5*STACK_MIN_SIZE, (uchar*) &new_h2)) + DBUG_RETURN(1); + DBUG_ASSERT(h->active_index != MAX_KEY); + uint mrr_keyno= h->active_index; + + /* Create a separate handler object to do rndpos() calls. */ + if (!(new_h2= h->clone(thd->mem_root)) || + new_h2->ha_external_lock(thd, F_RDLCK)) + { + delete new_h2; + DBUG_RETURN(1); + } + + if (mrr_keyno == h->pushed_idx_cond_keyno) + pushed_cond= h->pushed_idx_cond; + + /* + Caution: this call will invoke this->dsmrr_close(). Do not put the + created secondary table handler into this->h2 or it will delete it. + */ + if (h->ha_index_end()) + { + h2=new_h2; + goto error; + } + + h2= new_h2; /* Ok, now can put it into h2 */ + table->prepare_for_position(); + h2->extra(HA_EXTRA_KEYREAD); + + if (h2->ha_index_init(mrr_keyno, FALSE)) + goto error; + + use_default_impl= FALSE; + if (pushed_cond) + h2->idx_cond_push(mrr_keyno, pushed_cond); + } + else + { + /* + We get here when the access alternates betwen MRR scan(s) and non-MRR + scans. + + Calling h->index_end() will invoke dsmrr_close() for this object, + which will delete h2. We need to keep it, so save put it away and dont + let it be deleted: + */ + handler *save_h2= h2; + h2= NULL; + int res= (h->inited == handler::INDEX && h->ha_index_end()); + h2= save_h2; + use_default_impl= FALSE; + if (res) + goto error; + } + + if (h2->handler::multi_range_read_init(seq_funcs, seq_init_param, n_ranges, + mode, buf) || + dsmrr_fill_buffer()) + { + goto error; + } + /* + If the above call has scanned through all intervals in *seq, then + adjust *buf to indicate that the remaining buffer space will not be used. + */ + if (dsmrr_eof) + buf->end_of_used_area= rowids_buf_last; + + /* + h->inited == INDEX may occur when 'range checked for each record' is + used. + */ + if ((h->inited != handler::RND) && + ((h->inited==handler::INDEX? h->ha_index_end(): FALSE) || + (h->ha_rnd_init(FALSE)))) + goto error; + + use_default_impl= FALSE; + h->mrr_funcs= *seq_funcs; + + DBUG_RETURN(0); +error: + h2->ha_index_or_rnd_end(); + h2->ha_external_lock(current_thd, F_UNLCK); + h2->close(); + delete h2; + h2= NULL; + DBUG_RETURN(1); +} + + +void DsMrr_impl::dsmrr_close() +{ + DBUG_ENTER("DsMrr_impl::dsmrr_close"); + if (h2) + { + h2->ha_index_or_rnd_end(); + h2->ha_external_lock(current_thd, F_UNLCK); + h2->close(); + delete h2; + h2= NULL; + } + use_default_impl= TRUE; + DBUG_VOID_RETURN; +} + + +static int rowid_cmp(void *h, uchar *a, uchar *b) +{ + return ((handler*)h)->cmp_ref(a, b); +} + + +/** + DS-MRR: Fill the buffer with rowids and sort it by rowid + + {This is an internal function of DiskSweep MRR implementation} + Scan the MRR ranges and collect ROWIDs (or {ROWID, range_id} pairs) into + buffer. When the buffer is full or scan is completed, sort the buffer by + rowid and return. + + The function assumes that rowids buffer is empty when it is invoked. + + @param h Table handler + + @retval 0 OK, the next portion of rowids is in the buffer, + properly ordered + @retval other Error +*/ + +int DsMrr_impl::dsmrr_fill_buffer() +{ + char *range_info; + int res; + DBUG_ENTER("DsMrr_impl::dsmrr_fill_buffer"); + + rowids_buf_cur= rowids_buf; + while ((rowids_buf_cur < rowids_buf_end) && + !(res= h2->handler::multi_range_read_next(&range_info))) + { + KEY_MULTI_RANGE *curr_range= &h2->handler::mrr_cur_range; + if (h2->mrr_funcs.skip_index_tuple && + h2->mrr_funcs.skip_index_tuple(h2->mrr_iter, curr_range->ptr)) + continue; + + /* Put rowid, or {rowid, range_id} pair into the buffer */ + h2->position(table->record[0]); + memcpy(rowids_buf_cur, h2->ref, h2->ref_length); + rowids_buf_cur += h2->ref_length; + + if (is_mrr_assoc) + { + memcpy(rowids_buf_cur, &range_info, sizeof(void*)); + rowids_buf_cur += sizeof(void*); + } + } + + if (res && res != HA_ERR_END_OF_FILE) + DBUG_RETURN(res); + dsmrr_eof= test(res == HA_ERR_END_OF_FILE); + + /* Sort the buffer contents by rowid */ + uint elem_size= h->ref_length + (int)is_mrr_assoc * sizeof(void*); + uint n_rowids= (rowids_buf_cur - rowids_buf) / elem_size; + + my_qsort2(rowids_buf, n_rowids, elem_size, (qsort2_cmp)rowid_cmp, + (void*)h); + rowids_buf_last= rowids_buf_cur; + rowids_buf_cur= rowids_buf; + DBUG_RETURN(0); +} + + +/** + DS-MRR implementation: multi_range_read_next() function +*/ + +int DsMrr_impl::dsmrr_next(char **range_info) +{ + int res; + uchar *cur_range_info= 0; + uchar *rowid; + + if (use_default_impl) + return h->handler::multi_range_read_next(range_info); + + do + { + if (rowids_buf_cur == rowids_buf_last) + { + if (dsmrr_eof) + { + res= HA_ERR_END_OF_FILE; + goto end; + } + res= dsmrr_fill_buffer(); + if (res) + goto end; + } + + /* return eof if there are no rowids in the buffer after re-fill attempt */ + if (rowids_buf_cur == rowids_buf_last) + { + res= HA_ERR_END_OF_FILE; + goto end; + } + rowid= rowids_buf_cur; + + if (is_mrr_assoc) + memcpy(&cur_range_info, rowids_buf_cur + h->ref_length, sizeof(uchar**)); + + rowids_buf_cur += h->ref_length + sizeof(void*) * test(is_mrr_assoc); + if (h2->mrr_funcs.skip_record && + h2->mrr_funcs.skip_record(h2->mrr_iter, (char *) cur_range_info, rowid)) + continue; + res= h->rnd_pos(table->record[0], rowid); + break; + } while (true); + + if (is_mrr_assoc) + { + memcpy(range_info, rowid + h->ref_length, sizeof(void*)); + } +end: + return res; +} + + +/** + DS-MRR implementation: multi_range_read_info() function +*/ +ha_rows DsMrr_impl::dsmrr_info(uint keyno, uint n_ranges, uint rows, + uint *bufsz, uint *flags, COST_VECT *cost) +{ + ha_rows res; + uint def_flags= *flags; + uint def_bufsz= *bufsz; + + /* Get cost/flags/mem_usage of default MRR implementation */ + res= h->handler::multi_range_read_info(keyno, n_ranges, rows, &def_bufsz, + &def_flags, cost); + DBUG_ASSERT(!res); + + if ((*flags & HA_MRR_USE_DEFAULT_IMPL) || + choose_mrr_impl(keyno, rows, &def_flags, &def_bufsz, cost)) + { + /* Default implementation is choosen */ + DBUG_PRINT("info", ("Default MRR implementation choosen")); + *flags= def_flags; + *bufsz= def_bufsz; + } + else + { + /* *flags and *bufsz were set by choose_mrr_impl */ + DBUG_PRINT("info", ("DS-MRR implementation choosen")); + } + return 0; +} + + +/** + DS-MRR Implementation: multi_range_read_info_const() function +*/ + +ha_rows DsMrr_impl::dsmrr_info_const(uint keyno, RANGE_SEQ_IF *seq, + void *seq_init_param, uint n_ranges, + uint *bufsz, uint *flags, COST_VECT *cost) +{ + ha_rows rows; + uint def_flags= *flags; + uint def_bufsz= *bufsz; + /* Get cost/flags/mem_usage of default MRR implementation */ + rows= h->handler::multi_range_read_info_const(keyno, seq, seq_init_param, + n_ranges, &def_bufsz, + &def_flags, cost); + if (rows == HA_POS_ERROR) + { + /* Default implementation can't perform MRR scan => we can't either */ + return rows; + } + + /* + If HA_MRR_USE_DEFAULT_IMPL has been passed to us, that is an order to + use the default MRR implementation (we need it for UPDATE/DELETE). + Otherwise, make a choice based on cost and @@optimizer_use_mrr. + */ + if ((*flags & HA_MRR_USE_DEFAULT_IMPL) || + choose_mrr_impl(keyno, rows, flags, bufsz, cost)) + { + DBUG_PRINT("info", ("Default MRR implementation choosen")); + *flags= def_flags; + *bufsz= def_bufsz; + } + else + { + /* *flags and *bufsz were set by choose_mrr_impl */ + DBUG_PRINT("info", ("DS-MRR implementation choosen")); + } + return rows; +} + + +/** + Check if key has partially-covered columns + + We can't use DS-MRR to perform range scans when the ranges are over + partially-covered keys, because we'll not have full key part values + (we'll have their prefixes from the index) and will not be able to check + if we've reached the end the range. + + @param keyno Key to check + + @todo + Allow use of DS-MRR in cases where the index has partially-covered + components but they are not used for scanning. + + @retval TRUE Yes + @retval FALSE No +*/ + +bool key_uses_partial_cols(TABLE *table, uint keyno) +{ + KEY_PART_INFO *kp= table->key_info[keyno].key_part; + KEY_PART_INFO *kp_end= kp + table->key_info[keyno].key_parts; + for (; kp != kp_end; kp++) + { + if (!kp->field->part_of_key.is_set(keyno)) + return TRUE; + } + return FALSE; +} + +/** + DS-MRR Internals: Choose between Default MRR implementation and DS-MRR + + Make the choice between using Default MRR implementation and DS-MRR. + This function contains common functionality factored out of dsmrr_info() + and dsmrr_info_const(). The function assumes that the default MRR + implementation's applicability requirements are satisfied. + + @param keyno Index number + @param rows E(full rows to be retrieved) + @param flags IN MRR flags provided by the MRR user + OUT If DS-MRR is choosen, flags of DS-MRR implementation + else the value is not modified + @param bufsz IN If DS-MRR is choosen, buffer use of DS-MRR implementation + else the value is not modified + @param cost IN Cost of default MRR implementation + OUT If DS-MRR is choosen, cost of DS-MRR scan + else the value is not modified + + @retval TRUE Default MRR implementation should be used + @retval FALSE DS-MRR implementation should be used +*/ + +bool DsMrr_impl::choose_mrr_impl(uint keyno, ha_rows rows, uint *flags, + uint *bufsz, COST_VECT *cost) +{ + COST_VECT dsmrr_cost; + bool res; + THD *thd= current_thd; + if (thd->variables.optimizer_use_mrr == 2 || *flags & HA_MRR_INDEX_ONLY || + (keyno == table->s->primary_key && h->primary_key_is_clustered()) || + key_uses_partial_cols(table, keyno)) + { + /* Use the default implementation */ + *flags |= HA_MRR_USE_DEFAULT_IMPL; + return TRUE; + } + + uint add_len= table->key_info[keyno].key_length + h->ref_length; + *bufsz -= add_len; + if (get_disk_sweep_mrr_cost(keyno, rows, *flags, bufsz, &dsmrr_cost)) + return TRUE; + *bufsz += add_len; + + bool force_dsmrr; + /* + If @@optimizer_use_mrr==force, then set cost of DS-MRR to be minimum of + DS-MRR and Default implementations cost. This allows one to force use of + DS-MRR whenever it is applicable without affecting other cost-based + choices. + */ + if ((force_dsmrr= (thd->variables.optimizer_use_mrr == 1)) && + dsmrr_cost.total_cost() > cost->total_cost()) + dsmrr_cost= *cost; + + if (force_dsmrr || dsmrr_cost.total_cost() <= cost->total_cost()) + { + *flags &= ~HA_MRR_USE_DEFAULT_IMPL; /* Use the DS-MRR implementation */ + *flags &= ~HA_MRR_SORTED; /* We will return unordered output */ + *cost= dsmrr_cost; + res= FALSE; + } + else + { + /* Use the default MRR implementation */ + res= TRUE; + } + return res; +} + + +static void get_sort_and_sweep_cost(TABLE *table, ha_rows nrows, COST_VECT *cost); + + +/** + Get cost of DS-MRR scan + + @param keynr Index to be used + @param rows E(Number of rows to be scanned) + @param flags Scan parameters (HA_MRR_* flags) + @param buffer_size INOUT Buffer size + @param cost OUT The cost + + @retval FALSE OK + @retval TRUE Error, DS-MRR cannot be used (the buffer is too small + for even 1 rowid) +*/ + +bool DsMrr_impl::get_disk_sweep_mrr_cost(uint keynr, ha_rows rows, uint flags, + uint *buffer_size, COST_VECT *cost) +{ + ulong max_buff_entries, elem_size; + ha_rows rows_in_full_step, rows_in_last_step; + uint n_full_steps; + double index_read_cost; + + elem_size= h->ref_length + sizeof(void*) * (!test(flags & HA_MRR_NO_ASSOCIATION)); + max_buff_entries = *buffer_size / elem_size; + + if (!max_buff_entries) + return TRUE; /* Buffer has not enough space for even 1 rowid */ + + /* Number of iterations we'll make with full buffer */ + n_full_steps= (uint)floor(rows2double(rows) / max_buff_entries); + + /* + Get numbers of rows we'll be processing in + - non-last sweep, with full buffer + - last iteration, with non-full buffer + */ + rows_in_full_step= max_buff_entries; + rows_in_last_step= rows % max_buff_entries; + + /* Adjust buffer size if we expect to use only part of the buffer */ + if (n_full_steps) + { + get_sort_and_sweep_cost(table, rows, cost); + cost->multiply(n_full_steps); + } + else + { + cost->zero(); + *buffer_size= max(*buffer_size, + (size_t)(1.2*rows_in_last_step) * elem_size + + h->ref_length + table->key_info[keynr].key_length); + } + + COST_VECT last_step_cost; + get_sort_and_sweep_cost(table, rows_in_last_step, &last_step_cost); + cost->add(&last_step_cost); + + if (n_full_steps != 0) + cost->mem_cost= *buffer_size; + else + cost->mem_cost= (double)rows_in_last_step * elem_size; + + /* Total cost of all index accesses */ + index_read_cost= h->index_only_read_time(keynr, (double)rows); + cost->add_io(index_read_cost, 1 /* Random seeks */); + return FALSE; +} + + +/* + Get cost of one sort-and-sweep step + + SYNOPSIS + get_sort_and_sweep_cost() + table Table being accessed + nrows Number of rows to be sorted and retrieved + cost OUT The cost + + DESCRIPTION + Get cost of these operations: + - sort an array of #nrows ROWIDs using qsort + - read #nrows records from table in a sweep. +*/ + +static +void get_sort_and_sweep_cost(TABLE *table, ha_rows nrows, COST_VECT *cost) +{ + if (nrows) + { + get_sweep_read_cost(table, nrows, FALSE, cost); + /* Add cost of qsort call: n * log2(n) * cost(rowid_comparison) */ + double cmp_op= rows2double(nrows) * (1.0 / TIME_FOR_COMPARE_ROWID); + if (cmp_op < 3) + cmp_op= 3; + cost->cpu_cost += cmp_op * log2(cmp_op); + } + else + cost->zero(); +} + + +/** + Get cost of reading nrows table records in a "disk sweep" + + A disk sweep read is a sequence of handler->rnd_pos(rowid) calls that made + for an ordered sequence of rowids. + + We assume hard disk IO. The read is performed as follows: + + 1. The disk head is moved to the needed cylinder + 2. The controller waits for the plate to rotate + 3. The data is transferred + + Time to do #3 is insignificant compared to #2+#1. + + Time to move the disk head is proportional to head travel distance. + + Time to wait for the plate to rotate depends on whether the disk head + was moved or not. + + If disk head wasn't moved, the wait time is proportional to distance + between the previous block and the block we're reading. + + If the head was moved, we don't know how much we'll need to wait for the + plate to rotate. We assume the wait time to be a variate with a mean of + 0.5 of full rotation time. + + Our cost units are "random disk seeks". The cost of random disk seek is + actually not a constant, it depends one range of cylinders we're going + to access. We make it constant by introducing a fuzzy concept of "typical + datafile length" (it's fuzzy as it's hard to tell whether it should + include index file, temp.tables etc). Then random seek cost is: + + 1 = half_rotation_cost + move_cost * 1/3 * typical_data_file_length + + We define half_rotation_cost as DISK_SEEK_BASE_COST=0.9. + + @param table Table to be accessed + @param nrows Number of rows to retrieve + @param interrupted TRUE <=> Assume that the disk sweep will be + interrupted by other disk IO. FALSE - otherwise. + @param cost OUT The cost. +*/ + +void get_sweep_read_cost(TABLE *table, ha_rows nrows, bool interrupted, + COST_VECT *cost) +{ + DBUG_ENTER("get_sweep_read_cost"); + + cost->zero(); + if (table->file->primary_key_is_clustered()) + { + cost->io_count= table->file->read_time(table->s->primary_key, + (uint) nrows, nrows); + } + else + { + double n_blocks= + ceil(ulonglong2double(table->file->stats.data_file_length) / IO_SIZE); + double busy_blocks= + n_blocks * (1.0 - pow(1.0 - 1.0/n_blocks, rows2double(nrows))); + if (busy_blocks < 1.0) + busy_blocks= 1.0; + + DBUG_PRINT("info",("sweep: nblocks=%g, busy_blocks=%g", n_blocks, + busy_blocks)); + cost->io_count= busy_blocks; + + if (!interrupted) + { + /* Assume reading is done in one 'sweep' */ + cost->avg_io_cost= (DISK_SEEK_BASE_COST + + DISK_SEEK_PROP_COST*n_blocks/busy_blocks); + } + } + DBUG_PRINT("info",("returning cost=%g", cost->total_cost())); + DBUG_VOID_RETURN; +} + + +/* ************************************************************************** + * DS-MRR implementation ends + ***************************************************************************/ + +/* ************************************************************************** + * Index Condition Pushdown code starts + ***************************************************************************/ +/* + Check if given expression uses only table fields covered by the given index + + SYNOPSIS + uses_index_fields_only() + item Expression to check + tbl The table having the index + keyno The index number + other_tbls_ok TRUE <=> Fields of other non-const tables are allowed + + DESCRIPTION + Check if given expression only uses fields covered by index #keyno in the + table tbl. The expression can use any fields in any other tables. + + The expression is guaranteed not to be AND or OR - those constructs are + handled outside of this function. + + RETURN + TRUE Yes + FALSE No +*/ + +bool uses_index_fields_only(Item *item, TABLE *tbl, uint keyno, + bool other_tbls_ok) +{ + if (item->const_item()) + return TRUE; + + /* + Don't push down the triggered conditions. Nested outer joins execution + code may need to evaluate a condition several times (both triggered and + untriggered), and there is no way to put thi + TODO: Consider cloning the triggered condition and using the copies for: + 1. push the first copy down, to have most restrictive index condition + possible + 2. Put the second copy into tab->select_cond. + */ + if (item->type() == Item::FUNC_ITEM && + ((Item_func*)item)->functype() == Item_func::TRIG_COND_FUNC) + return FALSE; + + if (!(item->used_tables() & tbl->map)) + return other_tbls_ok; + + Item::Type item_type= item->type(); + switch (item_type) { + case Item::FUNC_ITEM: + { + /* This is a function, apply condition recursively to arguments */ + Item_func *item_func= (Item_func*)item; + Item **child; + Item **item_end= (item_func->arguments()) + item_func->argument_count(); + for (child= item_func->arguments(); child != item_end; child++) + { + if (!uses_index_fields_only(*child, tbl, keyno, other_tbls_ok)) + return FALSE; + } + return TRUE; + } + case Item::COND_ITEM: + { + /* + This is a AND/OR condition. Regular AND/OR clauses are handled by + make_cond_for_index() which will chop off the part that can be + checked with index. This code is for handling non-top-level AND/ORs, + e.g. func(x AND y). + */ + List_iterator<Item> li(*((Item_cond*)item)->argument_list()); + Item *item; + while ((item=li++)) + { + if (!uses_index_fields_only(item, tbl, keyno, other_tbls_ok)) + return FALSE; + } + return TRUE; + } + case Item::FIELD_ITEM: + { + Item_field *item_field= (Item_field*)item; + if (item_field->field->table != tbl) + return TRUE; + /* + The below is probably a repetition - the first part checks the + other two, but let's play it safe: + */ + return item_field->field->part_of_key.is_set(keyno) && + item_field->field->type() != MYSQL_TYPE_GEOMETRY && + item_field->field->type() != MYSQL_TYPE_BLOB; + } + case Item::REF_ITEM: + return uses_index_fields_only(item->real_item(), tbl, keyno, + other_tbls_ok); + default: + return FALSE; /* Play it safe, don't push unknown non-const items */ + } +} + +#define ICP_COND_USES_INDEX_ONLY 10 + +/* + Get a part of the condition that can be checked using only index fields + + SYNOPSIS + make_cond_for_index() + cond The source condition + table The table that is partially available + keyno The index in the above table. Only fields covered by the index + are available + other_tbls_ok TRUE <=> Fields of other non-const tables are allowed + + DESCRIPTION + Get a part of the condition that can be checked when for the given table + we have values only of fields covered by some index. The condition may + refer to other tables, it is assumed that we have values of all of their + fields. + + Example: + make_cond_for_index( + "cond(t1.field) AND cond(t2.key1) AND cond(t2.non_key) AND cond(t2.key2)", + t2, keyno(t2.key1)) + will return + "cond(t1.field) AND cond(t2.key2)" + + RETURN + Index condition, or NULL if no condition could be inferred. +*/ + +Item *make_cond_for_index(Item *cond, TABLE *table, uint keyno, + bool other_tbls_ok) +{ + if (!cond) + return NULL; + if (cond->type() == Item::COND_ITEM) + { + uint n_marked= 0; + if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC) + { + table_map used_tables= 0; + Item_cond_and *new_cond=new Item_cond_and; + if (!new_cond) + return (COND*) 0; + List_iterator<Item> li(*((Item_cond*) cond)->argument_list()); + Item *item; + while ((item=li++)) + { + Item *fix= make_cond_for_index(item, table, keyno, other_tbls_ok); + if (fix) + { + new_cond->argument_list()->push_back(fix); + used_tables|= fix->used_tables(); + } + n_marked += test(item->marker == ICP_COND_USES_INDEX_ONLY); + } + if (n_marked ==((Item_cond*)cond)->argument_list()->elements) + cond->marker= ICP_COND_USES_INDEX_ONLY; + switch (new_cond->argument_list()->elements) { + case 0: + return (COND*) 0; + case 1: + new_cond->used_tables_cache= used_tables; + return new_cond->argument_list()->head(); + default: + new_cond->quick_fix_field(); + new_cond->used_tables_cache= used_tables; + return new_cond; + } + } + else /* It's OR */ + { + Item_cond_or *new_cond=new Item_cond_or; + if (!new_cond) + return (COND*) 0; + List_iterator<Item> li(*((Item_cond*) cond)->argument_list()); + Item *item; + while ((item=li++)) + { + Item *fix= make_cond_for_index(item, table, keyno, other_tbls_ok); + if (!fix) + return (COND*) 0; + new_cond->argument_list()->push_back(fix); + n_marked += test(item->marker == ICP_COND_USES_INDEX_ONLY); + } + if (n_marked ==((Item_cond*)cond)->argument_list()->elements) + cond->marker= ICP_COND_USES_INDEX_ONLY; + new_cond->quick_fix_field(); + new_cond->used_tables_cache= ((Item_cond_or*) cond)->used_tables_cache; + new_cond->top_level_item(); + return new_cond; + } + } + + if (!uses_index_fields_only(cond, table, keyno, other_tbls_ok)) + return (COND*) 0; + cond->marker= ICP_COND_USES_INDEX_ONLY; + return cond; +} + + +Item *make_cond_remainder(Item *cond, bool exclude_index) +{ + if (exclude_index && cond->marker == ICP_COND_USES_INDEX_ONLY) + return 0; /* Already checked */ + + if (cond->type() == Item::COND_ITEM) + { + table_map tbl_map= 0; + if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC) + { + /* Create new top level AND item */ + Item_cond_and *new_cond=new Item_cond_and; + if (!new_cond) + return (COND*) 0; + List_iterator<Item> li(*((Item_cond*) cond)->argument_list()); + Item *item; + while ((item=li++)) + { + Item *fix= make_cond_remainder(item, exclude_index); + if (fix) + { + new_cond->argument_list()->push_back(fix); + tbl_map |= fix->used_tables(); + } + } + switch (new_cond->argument_list()->elements) { + case 0: + return (COND*) 0; + case 1: + return new_cond->argument_list()->head(); + default: + new_cond->quick_fix_field(); + ((Item_cond*)new_cond)->used_tables_cache= tbl_map; + return new_cond; + } + } + else /* It's OR */ + { + Item_cond_or *new_cond=new Item_cond_or; + if (!new_cond) + return (COND*) 0; + List_iterator<Item> li(*((Item_cond*) cond)->argument_list()); + Item *item; + while ((item=li++)) + { + Item *fix= make_cond_remainder(item, FALSE); + if (!fix) + return (COND*) 0; + new_cond->argument_list()->push_back(fix); + tbl_map |= fix->used_tables(); + } + new_cond->quick_fix_field(); + ((Item_cond*)new_cond)->used_tables_cache= tbl_map; + new_cond->top_level_item(); + return new_cond; + } + } + return cond; +} + + +/* + Try to extract and push the index condition + + SYNOPSIS + push_index_cond() + tab A join tab that has tab->table->file and its condition + in tab->select_cond + keyno Index for which extract and push the condition + other_tbls_ok TRUE <=> Fields of other non-const tables are allowed + + DESCRIPTION + Try to extract and push the index condition down to table handler +*/ + +void push_index_cond(JOIN_TAB *tab, uint keyno, bool other_tbls_ok) +{ + DBUG_ENTER("push_index_cond"); + Item *idx_cond; + bool do_index_cond_pushdown= + ((tab->table->file->index_flags(keyno, 0, 1) & + HA_DO_INDEX_COND_PUSHDOWN) && + tab->join->thd->variables.engine_condition_pushdown); + // psergey: + // + KEY *key_info= tab->table->key_info + keyno; + for (uint kp= 0; kp < key_info->key_parts; kp++) + { + if ((key_info->key_part[kp].key_part_flag & HA_PART_KEY_SEG)) + { + do_index_cond_pushdown= FALSE; + break; + } + } + // :psergey + /* + When WL#5116 is done this DBUG statement must be removed. It's just a + temporary hack to allow us to discriminate whether a test failure relates + to *Engine* or *Index* Condition Pushdown. + */ + DBUG_EXECUTE_IF("optimizer_no_icp", do_index_cond_pushdown= false;); + if (do_index_cond_pushdown) + { + DBUG_EXECUTE("where", + print_where(tab->select_cond, "full cond", QT_ORDINARY);); + + idx_cond= make_cond_for_index(tab->select_cond, tab->table, keyno, + other_tbls_ok); + + DBUG_EXECUTE("where", + print_where(idx_cond, "idx cond", QT_ORDINARY);); + + if (idx_cond) + { + Item *idx_remainder_cond= 0; + tab->pre_idx_push_select_cond= tab->select_cond; +#if 0 + // The following is only needed for BKA: + /* + For BKA cache we store condition to special BKA cache field + because evaluation of the condition requires additional operations + before the evaluation. This condition is used in + JOIN_CACHE_BKA[_UNIQUE]::skip_index_tuple() functions. + */ + if (tab->use_join_cache && + /* + if cache is used then the value is TRUE only + for BKA[_UNIQUE] cache (see check_join_cache_usage func). + In this case other_tbls_ok is an equivalent of + cache->is_key_access(). + */ + other_tbls_ok && + (idx_cond->used_tables() & + ~(tab->table->map | tab->join->const_table_map))) + tab->cache_idx_cond= idx_cond; + else +#endif + idx_remainder_cond= tab->table->file->idx_cond_push(keyno, idx_cond); + + /* + Disable eq_ref's "lookup cache" if we've pushed down an index + condition. + TODO: This check happens to work on current ICP implementations, but + there may exist a compliant implementation that will not work + correctly with it. Sort this out when we stabilize the condition + pushdown APIs. + */ + if (idx_remainder_cond != idx_cond) + tab->ref.disable_cache= TRUE; + + Item *row_cond= make_cond_remainder(tab->select_cond, TRUE); + + DBUG_EXECUTE("where", + print_where(row_cond, "remainder cond", QT_ORDINARY);); + + if (row_cond) + { + if (!idx_remainder_cond) + tab->select_cond= row_cond; + else + { + COND *new_cond= new Item_cond_and(row_cond, idx_remainder_cond); + tab->select_cond= new_cond; + tab->select_cond->quick_fix_field(); + ((Item_cond_and*)tab->select_cond)->used_tables_cache= + row_cond->used_tables() | idx_remainder_cond->used_tables(); + } + } + else + tab->select_cond= idx_remainder_cond; + if (tab->select) + { + DBUG_EXECUTE("where", + print_where(tab->select->cond, + "select_cond", + QT_ORDINARY);); + + tab->select->cond= tab->select_cond; + } + } + } + DBUG_VOID_RETURN; +} + +/* ************************************************************************** + * Default MRR implementation starts + ***************************************************************************/ + + +/**************************************************************************** + * Default MRR implementation (MRR to non-MRR converter) + ***************************************************************************/ + +/** + Get cost and other information about MRR scan over a known list of ranges + + Calculate estimated cost and other information about an MRR scan for given + sequence of ranges. + + @param keyno Index number + @param seq Range sequence to be traversed + @param seq_init_param First parameter for seq->init() + @param n_ranges_arg Number of ranges in the sequence, or 0 if the caller + can't efficiently determine it + @param bufsz INOUT IN: Size of the buffer available for use + OUT: Size of the buffer that is expected to be actually + used, or 0 if buffer is not needed. + @param flags INOUT A combination of HA_MRR_* flags + @param cost OUT Estimated cost of MRR access + + @note + This method (or an overriding one in a derived class) must check for + thd->killed and return HA_POS_ERROR if it is not zero. This is required + for a user to be able to interrupt the calculation by killing the + connection/query. + + @retval + HA_POS_ERROR Error or the engine is unable to perform the requested + scan. Values of OUT parameters are undefined. + @retval + other OK, *cost contains cost of the scan, *bufsz and *flags + contain scan parameters. +*/ + +ha_rows +handler::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, + void *seq_init_param, uint n_ranges_arg, + uint *bufsz, uint *flags, COST_VECT *cost) +{ + KEY_MULTI_RANGE range; + range_seq_t seq_it; + ha_rows rows, total_rows= 0; + uint n_ranges=0; + THD *thd= current_thd; + + /* Default MRR implementation doesn't need buffer */ + *bufsz= 0; + + seq_it= seq->init(seq_init_param, n_ranges, *flags); + while (!seq->next(seq_it, &range)) + { + if (unlikely(thd->killed != 0)) + return HA_POS_ERROR; + + n_ranges++; + key_range *min_endp, *max_endp; + if (range.range_flag & GEOM_FLAG) + { + /* In this case tmp_min_flag contains the handler-read-function */ + range.start_key.flag= (ha_rkey_function) (range.range_flag ^ GEOM_FLAG); + min_endp= &range.start_key; + max_endp= NULL; + } + else + { + min_endp= range.start_key.length? &range.start_key : NULL; + max_endp= range.end_key.length? &range.end_key : NULL; + } + if ((range.range_flag & UNIQUE_RANGE) && !(range.range_flag & NULL_RANGE)) + rows= 1; /* there can be at most one row */ + else + { + if (HA_POS_ERROR == (rows= this->records_in_range(keyno, min_endp, + max_endp))) + { + /* Can't scan one range => can't do MRR scan at all */ + total_rows= HA_POS_ERROR; + break; + } + } + total_rows += rows; + } + + if (total_rows != HA_POS_ERROR) + { + /* The following calculation is the same as in multi_range_read_info(): */ + *flags |= HA_MRR_USE_DEFAULT_IMPL; + cost->zero(); + cost->avg_io_cost= 1; /* assume random seeks */ + if ((*flags & HA_MRR_INDEX_ONLY) && total_rows > 2) + cost->io_count= index_only_read_time(keyno, (uint)total_rows); + else + cost->io_count= read_time(keyno, n_ranges, total_rows); + cost->cpu_cost= (double) total_rows / TIME_FOR_COMPARE + 0.01; + } + return total_rows; +} + + +/** + Get cost and other information about MRR scan over some sequence of ranges + + Calculate estimated cost and other information about an MRR scan for some + sequence of ranges. + + The ranges themselves will be known only at execution phase. When this + function is called we only know number of ranges and a (rough) E(#records) + within those ranges. + + Currently this function is only called for "n-keypart singlepoint" ranges, + i.e. each range is "keypart1=someconst1 AND ... AND keypartN=someconstN" + + The flags parameter is a combination of those flags: HA_MRR_SORTED, + HA_MRR_INDEX_ONLY, HA_MRR_NO_ASSOCIATION, HA_MRR_LIMITS. + + @param keyno Index number + @param n_ranges Estimated number of ranges (i.e. intervals) in the + range sequence. + @param n_rows Estimated total number of records contained within all + of the ranges + @param bufsz INOUT IN: Size of the buffer available for use + OUT: Size of the buffer that will be actually used, or + 0 if buffer is not needed. + @param flags INOUT A combination of HA_MRR_* flags + @param cost OUT Estimated cost of MRR access + + @retval + 0 OK, *cost contains cost of the scan, *bufsz and *flags contain scan + parameters. + @retval + other Error or can't perform the requested scan +*/ + +ha_rows handler::multi_range_read_info(uint keyno, uint n_ranges, uint n_rows, + uint *bufsz, uint *flags, COST_VECT *cost) +{ + *bufsz= 0; /* Default implementation doesn't need a buffer */ + + *flags |= HA_MRR_USE_DEFAULT_IMPL; + + cost->zero(); + cost->avg_io_cost= 1; /* assume random seeks */ + + /* Produce the same cost as non-MRR code does */ + if (*flags & HA_MRR_INDEX_ONLY) + cost->io_count= index_only_read_time(keyno, n_rows); + else + cost->io_count= read_time(keyno, n_ranges, n_rows); + return 0; +} + + +/** + Initialize the MRR scan + + Initialize the MRR scan. This function may do heavyweight scan + initialization like row prefetching/sorting/etc (NOTE: but better not do + it here as we may not need it, e.g. if we never satisfy WHERE clause on + previous tables. For many implementations it would be natural to do such + initializations in the first multi_read_range_next() call) + + mode is a combination of the following flags: HA_MRR_SORTED, + HA_MRR_INDEX_ONLY, HA_MRR_NO_ASSOCIATION + + @param seq Range sequence to be traversed + @param seq_init_param First parameter for seq->init() + @param n_ranges Number of ranges in the sequence + @param mode Flags, see the description section for the details + @param buf INOUT: memory buffer to be used + + @note + One must have called index_init() before calling this function. Several + multi_range_read_init() calls may be made in course of one query. + + Until WL#2623 is done (see its text, section 3.2), the following will + also hold: + The caller will guarantee that if "seq->init == mrr_ranges_array_init" + then seq_init_param is an array of n_ranges KEY_MULTI_RANGE structures. + This property will only be used by NDB handler until WL#2623 is done. + + Buffer memory management is done according to the following scenario: + The caller allocates the buffer and provides it to the callee by filling + the members of HANDLER_BUFFER structure. + The callee consumes all or some fraction of the provided buffer space, and + sets the HANDLER_BUFFER members accordingly. + The callee may use the buffer memory until the next multi_range_read_init() + call is made, all records have been read, or until index_end() call is + made, whichever comes first. + + @retval 0 OK + @retval 1 Error +*/ + +int +handler::multi_range_read_init(RANGE_SEQ_IF *seq_funcs, void *seq_init_param, + uint n_ranges, uint mode, HANDLER_BUFFER *buf) +{ + DBUG_ENTER("handler::multi_range_read_init"); + mrr_iter= seq_funcs->init(seq_init_param, n_ranges, mode); + mrr_funcs= *seq_funcs; + mrr_is_output_sorted= test(mode & HA_MRR_SORTED); + mrr_have_range= FALSE; + DBUG_RETURN(0); +} + + +/** + Get next record in MRR scan + + Default MRR implementation: read the next record + + @param range_info OUT Undefined if HA_MRR_NO_ASSOCIATION flag is in effect + Otherwise, the opaque value associated with the range + that contains the returned record. + + @retval 0 OK + @retval other Error code +*/ + +int handler::multi_range_read_next(char **range_info) +{ + int UNINIT_VAR(result); + int range_res; + DBUG_ENTER("handler::multi_range_read_next"); + + if (!mrr_have_range) + { + mrr_have_range= TRUE; + goto start; + } + + do + { + /* Save a call if there can be only one row in range. */ + if (mrr_cur_range.range_flag != (UNIQUE_RANGE | EQ_RANGE)) + { + result= read_range_next(); + /* On success or non-EOF errors jump to the end. */ + if (result != HA_ERR_END_OF_FILE) + break; + } + else + { + if (was_semi_consistent_read()) + goto scan_it_again; + /* + We need to set this for the last range only, but checking this + condition is more expensive than just setting the result code. + */ + result= HA_ERR_END_OF_FILE; + } + +start: + /* Try the next range(s) until one matches a record. */ + while (!(range_res= mrr_funcs.next(mrr_iter, &mrr_cur_range))) + { +scan_it_again: + result= read_range_first(mrr_cur_range.start_key.keypart_map ? + &mrr_cur_range.start_key : 0, + mrr_cur_range.end_key.keypart_map ? + &mrr_cur_range.end_key : 0, + test(mrr_cur_range.range_flag & EQ_RANGE), + mrr_is_output_sorted); + if (result != HA_ERR_END_OF_FILE) + break; + } + } + while ((result == HA_ERR_END_OF_FILE) && !range_res); + + *range_info= mrr_cur_range.ptr; + DBUG_PRINT("exit",("handler::multi_range_read_next result %d", result)); + DBUG_RETURN(result); +} + diff --git a/sql/ds_mrr.h b/sql/ds_mrr.h new file mode 100644 index 00000000000..02abe72a4c1 --- /dev/null +++ b/sql/ds_mrr.h @@ -0,0 +1,68 @@ + + +/** + A Disk-Sweep MRR interface implementation + + This implementation makes range (and, in the future, 'ref') scans to read + table rows in disk sweeps. + + Currently it is used by MyISAM and InnoDB. Potentially it can be used with + any table handler that has non-clustered indexes and on-disk rows. +*/ + +class DsMrr_impl +{ +public: + typedef void (handler::*range_check_toggle_func_t)(bool on); + + DsMrr_impl() + : h2(NULL) {}; + + /* + The "owner" handler object (the one that calls dsmrr_XXX functions. + It is used to retrieve full table rows by calling rnd_pos(). + */ + handler *h; + TABLE *table; /* Always equal to h->table */ +private: + /* Secondary handler object. It is used for scanning the index */ + handler *h2; + + /* Buffer to store rowids, or (rowid, range_id) pairs */ + uchar *rowids_buf; + uchar *rowids_buf_cur; /* Current position when reading/writing */ + uchar *rowids_buf_last; /* When reading: end of used buffer space */ + uchar *rowids_buf_end; /* End of the buffer */ + + bool dsmrr_eof; /* TRUE <=> We have reached EOF when reading index tuples */ + + /* TRUE <=> need range association, buffer holds {rowid, range_id} pairs */ + bool is_mrr_assoc; + + bool use_default_impl; /* TRUE <=> shortcut all calls to default MRR impl */ +public: + void init(handler *h_arg, TABLE *table_arg) + { + h= h_arg; + table= table_arg; + } + int dsmrr_init(handler *h, RANGE_SEQ_IF *seq_funcs, void *seq_init_param, + uint n_ranges, uint mode, HANDLER_BUFFER *buf); + void dsmrr_close(); + int dsmrr_fill_buffer(); + int dsmrr_next(char **range_info); + + ha_rows dsmrr_info(uint keyno, uint n_ranges, uint keys, uint *bufsz, + uint *flags, COST_VECT *cost); + + ha_rows dsmrr_info_const(uint keyno, RANGE_SEQ_IF *seq, + void *seq_init_param, uint n_ranges, uint *bufsz, + uint *flags, COST_VECT *cost); +private: + bool choose_mrr_impl(uint keyno, ha_rows rows, uint *flags, uint *bufsz, + COST_VECT *cost); + bool get_disk_sweep_mrr_cost(uint keynr, ha_rows rows, uint flags, + uint *buffer_size, COST_VECT *cost); +}; + + diff --git a/sql/handler.cc b/sql/handler.cc index 3ff9a63b76e..3f4fec8f23a 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -4161,6 +4161,41 @@ void ha_binlog_log_query(THD *thd, handlerton *hton, } #endif + +/** + Calculate cost of 'index only' scan for given index and number of records + + @param keynr Index number + @param records Estimated number of records to be retrieved + + @note + It is assumed that we will read trough the whole key range and that all + key blocks are half full (normally things are much better). It is also + assumed that each time we read the next key from the index, the handler + performs a random seek, thus the cost is proportional to the number of + blocks read. + + @todo + Consider joining this function and handler::read_time() into one + handler::read_time(keynr, records, ranges, bool index_only) function. + + @return + Estimated cost of 'index only' scan +*/ + +double handler::index_only_read_time(uint keynr, double records) +{ + double read_time; + uint keys_per_block= (stats.block_size/2/ + (table->key_info[keynr].key_length + ref_length) + 1); + read_time=((double) (records + keys_per_block-1) / + (double) keys_per_block); + return read_time; +} + +#if 0 +// psergey-mrr + /** Read the first row of a multi-range set. @@ -4287,7 +4322,7 @@ scan_it_again: DBUG_PRINT("exit",("handler::read_multi_range_next: result %d", result)); DBUG_RETURN(result); } - +#endif /** Read first row between two ranges. @@ -4391,7 +4426,7 @@ int handler::read_range_next() int handler::compare_key(key_range *range) { int cmp; - if (!range) + if (!range || in_range_check_pushed_down) return 0; // No max range cmp= key_cmp(range_key_part, range->key, range->length); if (!cmp) @@ -4400,6 +4435,23 @@ int handler::compare_key(key_range *range) } +/* + Same as compare_key() but doesn't check have in_range_check_pushed_down. + This is used by index condition pushdown implementation. +*/ + +int handler::compare_key2(key_range *range) +{ + int cmp; + if (!range) + return 0; // no max range + cmp= key_cmp(range_key_part, range->key, range->length); + if (!cmp) + cmp= key_compare_result_on_equal; + return cmp; +} + + int handler::index_read_idx_map(uchar * buf, uint index, const uchar * key, key_part_map keypart_map, enum ha_rkey_function find_flag) diff --git a/sql/handler.h b/sql/handler.h index cfea6175733..36c1a37f200 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -132,6 +132,8 @@ /* Has automatic checksums and uses the new checksum format */ #define HA_HAS_NEW_CHECKSUM (LL(1) << 36) +#define HA_MRR_CANT_SORT (LL(1) << 37) + /* Set of all binlog flags. Currently only contain the capabilities flags. @@ -147,6 +149,15 @@ #define HA_KEYREAD_ONLY 64 /* Support HA_EXTRA_KEYREAD */ /* + Index scan will not return records in rowid order. Not guaranteed to be + set for unordered (e.g. HASH) indexes. +*/ +#define HA_KEY_SCAN_NOT_ROR 128 +#define HA_DO_INDEX_COND_PUSHDOWN 256 /* Supports Index Condition Pushdown */ + + + +/* bits in alter_table_flags: */ /* @@ -199,12 +210,6 @@ #define HA_FAST_CHANGE_PARTITION (1L << 13) #define HA_PARTITION_ONE_PHASE (1L << 14) -/* - Index scan will not return records in rowid order. Not guaranteed to be - set for unordered (e.g. HASH) indexes. -*/ -#define HA_KEY_SCAN_NOT_ROR 128 - /* operations for disable/enable indexes */ #define HA_KEY_SWITCH_NONUNIQ 0 #define HA_KEY_SWITCH_ALL 1 @@ -1015,6 +1020,186 @@ typedef struct st_ha_check_opt } HA_CHECK_OPT; +/******************************************************************************** + * MRR + ********************************************************************************/ + +typedef void *range_seq_t; + +typedef struct st_range_seq_if +{ + /* + Initialize the traversal of range sequence + + SYNOPSIS + init() + init_params The seq_init_param parameter + n_ranges The number of ranges obtained + flags A combination of HA_MRR_SINGLE_POINT, HA_MRR_FIXED_KEY + + RETURN + An opaque value to be used as RANGE_SEQ_IF::next() parameter + */ + range_seq_t (*init)(void *init_params, uint n_ranges, uint flags); + + + /* + Get the next range in the range sequence + + SYNOPSIS + next() + seq The value returned by RANGE_SEQ_IF::init() + range OUT Information about the next range + + RETURN + 0 - Ok, the range structure filled with info about the next range + 1 - No more ranges + */ + uint (*next) (range_seq_t seq, KEY_MULTI_RANGE *range); + + /* + Check whether range_info orders to skip the next record + + SYNOPSIS + skip_record() + seq The value returned by RANGE_SEQ_IF::init() + range_info Information about the next range + (Ignored if MRR_NO_ASSOCIATION is set) + rowid Rowid of the record to be checked (ignored if set to 0) + + RETURN + 1 - Record with this range_info and/or this rowid shall be filtered + out from the stream of records returned by multi_range_read_next() + 0 - The record shall be left in the stream + */ + bool (*skip_record) (range_seq_t seq, char *range_info, uchar *rowid); + + /* + Check if the record combination matches the index condition + SYNOPSIS + skip_index_tuple() + seq The value returned by RANGE_SEQ_IF::init() + range_info Information about the next range + + RETURN + 0 - The record combination satisfies the index condition + 1 - Otherwise + */ + bool (*skip_index_tuple) (range_seq_t seq, char *range_info); +} RANGE_SEQ_IF; + +class COST_VECT +{ +public: + double io_count; /* number of I/O */ + double avg_io_cost; /* cost of an average I/O oper. */ + double cpu_cost; /* cost of operations in CPU */ + double mem_cost; /* cost of used memory */ + double import_cost; /* cost of remote operations */ + + enum { IO_COEFF=1 }; + enum { CPU_COEFF=1 }; + enum { MEM_COEFF=1 }; + enum { IMPORT_COEFF=1 }; + + COST_VECT() {} // keep gcc happy + + double total_cost() + { + return IO_COEFF*io_count*avg_io_cost + CPU_COEFF * cpu_cost + + MEM_COEFF*mem_cost + IMPORT_COEFF*import_cost; + } + + void zero() + { + avg_io_cost= 1.0; + io_count= cpu_cost= mem_cost= import_cost= 0.0; + } + + void multiply(double m) + { + io_count *= m; + cpu_cost *= m; + import_cost *= m; + /* Don't multiply mem_cost */ + } + + void add(const COST_VECT* cost) + { + double io_count_sum= io_count + cost->io_count; + add_io(cost->io_count, cost->avg_io_cost); + io_count= io_count_sum; + cpu_cost += cost->cpu_cost; + } + void add_io(double add_io_cnt, double add_avg_cost) + { + double io_count_sum= io_count + add_io_cnt; + avg_io_cost= (io_count * avg_io_cost + + add_io_cnt * add_avg_cost) / io_count_sum; + io_count= io_count_sum; + } + + /* + To be used when we go from old single value-based cost calculations to + the new COST_VECT-based. + */ + void convert_from_cost(double cost) + { + zero(); + avg_io_cost= 1.0; + io_count= cost; + } +}; + +void get_sweep_read_cost(TABLE *table, ha_rows nrows, bool interrupted, + COST_VECT *cost); + +/* + The below two are not used (and not handled) in this milestone of this WL + entry because there seems to be no use for them at this stage of + implementation. +*/ +#define HA_MRR_SINGLE_POINT 1 +#define HA_MRR_FIXED_KEY 2 + +/* + Indicates that RANGE_SEQ_IF::next(&range) doesn't need to fill in the + 'range' parameter. +*/ +#define HA_MRR_NO_ASSOCIATION 4 + +/* + The MRR user will provide ranges in key order, and MRR implementation + must return rows in key order. +*/ +#define HA_MRR_SORTED 8 + +/* MRR implementation doesn't have to retrieve full records */ +#define HA_MRR_INDEX_ONLY 16 + +/* + The passed memory buffer is of maximum possible size, the caller can't + assume larger buffer. +*/ +#define HA_MRR_LIMITS 32 + + +/* + Flag set <=> default MRR implementation is used + (The choice is made by **_info[_const]() function which may set this + flag. SQL layer remembers the flag value and then passes it to + multi_read_range_init(). +*/ +#define HA_MRR_USE_DEFAULT_IMPL 64 + +/* + Used only as parameter to multi_range_read_info(): + Flag set <=> the caller guarantees that the bounds of the scanned ranges + will not have NULL values. +*/ +#define HA_MRR_NO_NULL_ENDPOINTS 128 + + /* This is a buffer area that the handler can use to store rows. @@ -1025,8 +1210,8 @@ typedef struct st_ha_check_opt typedef struct st_handler_buffer { - const uchar *buffer; /* Buffer one can start using */ - const uchar *buffer_end; /* End of buffer */ + /* const? */uchar *buffer; /* Buffer one can start using */ + /* const? */uchar *buffer_end; /* End of buffer */ uchar *end_of_used_area; /* End of area that was used by handler */ } HANDLER_BUFFER; @@ -1057,11 +1242,16 @@ public: ulong update_time; uint block_size; /* index block size */ + /* + number of buffer bytes that native mrr implementation needs, + */ + uint mrr_length_per_rec; + ha_statistics(): data_file_length(0), max_data_file_length(0), index_file_length(0), delete_length(0), auto_increment_value(0), records(0), deleted(0), mean_rec_length(0), create_time(0), - check_time(0), update_time(0), block_size(0) + check_time(0), update_time(0), block_size(0), mrr_length_per_rec(0) {} }; @@ -1101,10 +1291,27 @@ public: ha_statistics stats; /** The following are for read_multi_range */ +//////psergey: was: +#if 0 bool multi_range_sorted; KEY_MULTI_RANGE *multi_range_curr; KEY_MULTI_RANGE *multi_range_end; HANDLER_BUFFER *multi_range_buffer; +#endif +//////psergey + /** MultiRangeRead-related members: */ + range_seq_t mrr_iter; /* Interator to traverse the range sequence */ + RANGE_SEQ_IF mrr_funcs; /* Range sequence traversal functions */ + HANDLER_BUFFER *multi_range_buffer; /* MRR buffer info */ + uint ranges_in_seq; /* Total number of ranges in the traversed sequence */ + /* TRUE <=> source MRR ranges and the output are ordered */ + bool mrr_is_output_sorted; + + /** TRUE <=> we're currently traversing a range in mrr_cur_range. */ + bool mrr_have_range; + /** Current range (the one we're now returning rows from) */ + KEY_MULTI_RANGE mrr_cur_range; +//////psergey /** The following are for read_range() */ key_range save_end_range, *end_range; @@ -1112,6 +1319,12 @@ public: int key_compare_result_on_equal; bool eq_range; + /* + TRUE <=> the engine guarantees that returned records are within the range + being scanned. + */ + bool in_range_check_pushed_down; + uint errkey; /* Last dup key */ uint key_used_on_scan; uint active_index; @@ -1122,6 +1335,8 @@ public: bool locked; bool implicit_emptied; /* Can be !=0 only if HEAP */ const COND *pushed_cond; + Item *pushed_idx_cond; + uint pushed_idx_cond_keyno; /* The index which the above condition is for */ /** next_insert_id is the next value which should be inserted into the auto_increment column: in a inserting-multi-row statement (like INSERT @@ -1161,7 +1376,8 @@ public: handler(handlerton *ht_arg, TABLE_SHARE *share_arg) :table_share(share_arg), table(0), estimation_rows_to_insert(0), ht(ht_arg), - ref(0), key_used_on_scan(MAX_KEY), active_index(MAX_KEY), + ref(0), in_range_check_pushed_down(FALSE), + key_used_on_scan(MAX_KEY), active_index(MAX_KEY), ref_length(sizeof(my_off_t)), ft_handler(0), inited(NONE), locked(FALSE), implicit_emptied(0), @@ -1192,6 +1408,7 @@ public: DBUG_ASSERT(inited==NONE); if (!(result= index_init(idx, sorted))) inited=INDEX; + end_range= NULL; DBUG_RETURN(result); } int ha_index_end() @@ -1199,6 +1416,7 @@ public: DBUG_ENTER("ha_index_end"); DBUG_ASSERT(inited==INDEX); inited=NONE; + end_range= NULL; DBUG_RETURN(index_end()); } /* This is called after index_init() if we need to do a index scan */ @@ -1307,6 +1525,7 @@ public: { return ulonglong2double(stats.data_file_length) / IO_SIZE + 2; } virtual double read_time(uint index, uint ranges, ha_rows rows) { return rows2double(ranges+rows); } + virtual double index_only_read_time(uint keynr, double records); virtual const key_map *keys_to_use_for_scanning() { return &key_map_empty; } bool has_transactions() { return (ha_table_flags() & HA_NO_TRANSACTIONS) == 0; } @@ -1523,16 +1742,30 @@ public: update_index_statistics(); return error; } - +#if 0 virtual int read_multi_range_first(KEY_MULTI_RANGE **found_range_p, KEY_MULTI_RANGE *ranges, uint range_count, bool sorted, HANDLER_BUFFER *buffer); virtual int read_multi_range_next(KEY_MULTI_RANGE **found_range_p); +#endif + //psergey-mrr: + virtual ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, uint *bufsz, + uint *flags, COST_VECT *cost); + virtual ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys, + uint *bufsz, uint *flags, COST_VECT *cost); + virtual int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, + uint n_ranges, uint mode, + HANDLER_BUFFER *buf); + virtual int multi_range_read_next(char **range_info); + //psergey-mrr: ends virtual int read_range_first(const key_range *start_key, const key_range *end_key, bool eq_range, bool sorted); virtual int read_range_next(); int compare_key(key_range *range); + int compare_key2(key_range *range); virtual int ft_init() { return HA_ERR_WRONG_COMMAND; } void ft_end() { ft_handler=NULL; } virtual FT_INFO *ft_init_ext(uint flags, uint inx,String *key) @@ -1878,6 +2111,7 @@ public: Pops the top if condition stack, if stack is not empty. */ virtual void cond_pop() { return; }; + virtual Item *idx_cond_push(uint keyno, Item* idx_cond) { return idx_cond; } virtual bool check_if_incompatible_data(HA_CREATE_INFO *create_info, uint table_changes) { return COMPATIBLE_DATA_NO; } @@ -2093,8 +2327,10 @@ private: virtual int rename_partitions(const char *path) { return HA_ERR_WRONG_COMMAND; } friend class ha_partition; + friend class DsMrr_impl; }; +#include "ds_mrr.h" /* Some extern variables used with handlers */ diff --git a/sql/item.h b/sql/item.h index 82fb3f3a3e0..640b0cc5375 100644 --- a/sql/item.h +++ b/sql/item.h @@ -25,7 +25,7 @@ bool trace_unsupported_func(const char *where, const char *processor_name) sprintf(buff, "%s::%s", where, processor_name); DBUG_ENTER(buff); sprintf(buff, "%s returns TRUE: unsupported function", processor_name); - DBUG_PRINT("info", (buff)); + DBUG_PRINT("info", ("%s", buff)); DBUG_RETURN(TRUE); } diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 77f55db145a..4f576bfca4c 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -345,11 +345,11 @@ protected: The cost of average seek DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST*BLOCKS_IN_AVG_SEEK =1.0. */ -#define DISK_SEEK_BASE_COST ((double)0.5) +#define DISK_SEEK_BASE_COST ((double)0.9) #define BLOCKS_IN_AVG_SEEK 128 -#define DISK_SEEK_PROP_COST ((double)0.5/BLOCKS_IN_AVG_SEEK) +#define DISK_SEEK_PROP_COST ((double)0.1/BLOCKS_IN_AVG_SEEK) /** diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 81f02157ee0..9ef69e3f5a6 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3526,6 +3526,8 @@ static int init_common_variables(const char *conf_file_name, int argc, global_system_variables.character_set_results= default_charset_info; global_system_variables.character_set_client= default_charset_info; + global_system_variables.optimizer_use_mrr= 1; + if (!(character_set_filesystem= get_charset_by_csname(character_set_filesystem_name, MY_CS_PRIMARY, MYF(MY_WME)))) @@ -6961,11 +6963,6 @@ The minimum value for this variable is 4096.", (uchar**) &global_system_variables.min_examined_row_limit, (uchar**) &max_system_variables.min_examined_row_limit, 0, GET_ULONG, REQUIRED_ARG, 0, 0, (longlong) ULONG_MAX, 0, 1L, 0}, - {"multi_range_count", OPT_MULTI_RANGE_COUNT, - "Number of key ranges to request at once.", - (uchar**) &global_system_variables.multi_range_count, - (uchar**) &max_system_variables.multi_range_count, 0, - GET_ULONG, REQUIRED_ARG, 256, 1, (longlong) ULONG_MAX, 0, 1, 0}, {"myisam_block_size", OPT_MYISAM_BLOCK_SIZE, "Block size to be used for MyISAM index pages.", (uchar**) &opt_myisam_block_size, @@ -7129,7 +7126,7 @@ The minimum value for this variable is 4096.", (uchar**) &global_system_variables.read_rnd_buff_size, (uchar**) &max_system_variables.read_rnd_buff_size, 0, GET_ULONG, REQUIRED_ARG, 256*1024L, IO_SIZE*2+MALLOC_OVERHEAD, - INT_MAX32, MALLOC_OVERHEAD, IO_SIZE, 0}, + INT_MAX32, MALLOC_OVERHEAD, 1 /* Small overhead to be able to test MRR, was: IO_SIZE*/ , 0}, {"record_buffer", OPT_RECORD_BUFFER, "Alias for read_buffer_size", (uchar**) &global_system_variables.read_buff_size, diff --git a/sql/opt_range.cc b/sql/opt_range.cc index adb5a7c8c96..c75999da00c 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -34,7 +34,7 @@ The lists are returned in form of complicated structure of interlinked SEL_TREE/SEL_IMERGE/SEL_ARG objects. - See check_quick_keys, find_used_partitions for examples of how to walk + See quick_range_seq_next, find_used_partitions for examples of how to walk this structure. All direct "users" of this module are located within this file, too. @@ -59,6 +59,48 @@ Record retrieval code for range/index_merge/groupby-min-max. Implementations of QUICK_*_SELECT classes. + + KeyTupleFormat + ~~~~~~~~~~~~~~ + The code in this file (and elsewhere) makes operations on key value tuples. + Those tuples are stored in the following format: + + The tuple is a sequence of key part values. The length of key part value + depends only on its type (and not depends on the what value is stored) + + KeyTuple: keypart1-data, keypart2-data, ... + + The value of each keypart is stored in the following format: + + keypart_data: [isnull_byte] keypart-value-bytes + + If a keypart may have a NULL value (key_part->field->real_maybe_null() can + be used to check this), then the first byte is a NULL indicator with the + following valid values: + 1 - keypart has NULL value. + 0 - keypart has non-NULL value. + + <questionable-statement> If isnull_byte==1 (NULL value), then the following + keypart->length bytes must be 0. + </questionable-statement> + + keypart-value-bytes holds the value. Its format depends on the field type. + The length of keypart-value-bytes may or may not depend on the value being + stored. The default is that length is static and equal to + KEY_PART_INFO::length. + + Key parts with (key_part_flag & HA_BLOB_PART) have length depending of the + value: + + keypart-value-bytes: value_length value_bytes + + The value_length part itself occupies HA_KEY_BLOB_LENGTH=2 bytes. + + See key_copy() and key_restore() for code to move data between index tuple + and table record + + CAUTION: the above description is only sergefp's understanding of the + subject and may omit some details. */ #ifdef USE_PRAGMA_IMPLEMENTATION @@ -403,6 +445,7 @@ public: /* returns a number of keypart values (0 or 1) appended to the key buffer */ int store_min(uint length, uchar **min_key,uint min_key_flag) { + /* "(kp1 > c1) AND (kp2 OP c2) AND ..." -> (kp1 > c1) */ if ((min_flag & GEOM_FLAG) || (!(min_flag & NO_MIN_RANGE) && !(min_key_flag & (NO_MIN_RANGE | NEAR_MIN)))) @@ -627,6 +670,11 @@ public: */ bool using_real_indexes; + /* + Aggressively remove "scans" that do not have conditions on first + keyparts. Such scans are usable when doing partition pruning but not + regular range optimization. + */ bool remove_jump_scans; /* @@ -634,8 +682,17 @@ public: using_real_indexes==TRUE */ uint real_keynr[MAX_KEY]; + + /* + Used to store 'current key tuples', in both range analysis and + partitioning (list) analysis + */ + uchar min_key[MAX_KEY_LENGTH+MAX_FIELD_WIDTH], + max_key[MAX_KEY_LENGTH+MAX_FIELD_WIDTH]; + /* Number of SEL_ARG objects allocated by SEL_ARG::clone_tree operations */ uint alloced_sel_args; + bool force_default_mrr; }; class PARAM : public RANGE_OPT_PARAM @@ -645,8 +702,6 @@ public: longlong baseflag; uint max_key_part, range_count; - uchar min_key[MAX_KEY_LENGTH+MAX_FIELD_WIDTH], - max_key[MAX_KEY_LENGTH+MAX_FIELD_WIDTH]; bool quick; // Don't calulate possible keys uint fields_bitmap_size; @@ -683,15 +738,14 @@ static SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param,COND *cond_func,Field *field, static SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param,COND *cond); static bool is_key_scan_ror(PARAM *param, uint keynr, uint8 nparts); -static ha_rows check_quick_select(PARAM *param,uint index,SEL_ARG *key_tree, - bool update_tbl_stats); -static ha_rows check_quick_keys(PARAM *param,uint index,SEL_ARG *key_tree, - uchar *min_key, uint min_key_flag, int, - uchar *max_key, uint max_key_flag, int); +static ha_rows check_quick_select(PARAM *param, uint idx, bool index_only, + SEL_ARG *tree, bool update_tbl_stats, + uint *mrr_flags, uint *bufsize, + COST_VECT *cost); QUICK_RANGE_SELECT *get_quick_select(PARAM *param,uint index, - SEL_ARG *key_tree, - MEM_ROOT *alloc = NULL); + SEL_ARG *key_tree, uint mrr_flags, + uint mrr_buf_size, MEM_ROOT *alloc); static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, bool index_read_must_be_used, bool update_tbl_stats, @@ -709,8 +763,6 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, double read_time); static TRP_GROUP_MIN_MAX *get_best_group_min_max(PARAM *param, SEL_TREE *tree); -static double get_index_only_read_time(const PARAM* param, ha_rows records, - int keynr); #ifndef DBUG_OFF static void print_sel_tree(PARAM *param, SEL_TREE *tree, key_map *tree_map, @@ -1099,25 +1151,22 @@ QUICK_SELECT_I::QUICK_SELECT_I() {} QUICK_RANGE_SELECT::QUICK_RANGE_SELECT(THD *thd, TABLE *table, uint key_nr, - bool no_alloc, MEM_ROOT *parent_alloc) - :dont_free(0),error(0),free_file(0),in_range(0),cur_range(NULL),last_range(0) + bool no_alloc, MEM_ROOT *parent_alloc, + bool *create_error) + :free_file(0),cur_range(NULL),last_range(0),dont_free(0) { my_bitmap_map *bitmap; DBUG_ENTER("QUICK_RANGE_SELECT::QUICK_RANGE_SELECT"); in_ror_merged_scan= 0; - sorted= 0; index= key_nr; head= table; key_part_info= head->key_info[index].key_part; my_init_dynamic_array(&ranges, sizeof(QUICK_RANGE*), 16, 16); /* 'thd' is not accessible in QUICK_RANGE_SELECT::reset(). */ - multi_range_bufsiz= thd->variables.read_rnd_buff_size; - multi_range_count= thd->variables.multi_range_count; - multi_range_length= 0; - multi_range= NULL; - multi_range_buff= NULL; + mrr_buf_size= thd->variables.read_rnd_buff_size; + mrr_buf_desc= NULL; if (!no_alloc && !parent_alloc) { @@ -1132,12 +1181,12 @@ QUICK_RANGE_SELECT::QUICK_RANGE_SELECT(THD *thd, TABLE *table, uint key_nr, save_read_set= head->read_set; save_write_set= head->write_set; - /* Allocate a bitmap for used columns */ + /* Allocate a bitmap for used columns (Q: why not on MEM_ROOT?) */ if (!(bitmap= (my_bitmap_map*) my_malloc(head->s->column_bitmap_size, MYF(MY_WME)))) { column_bitmap.bitmap= 0; - error= 1; + *create_error= 1; } else bitmap_init(&column_bitmap, bitmap, head->s->fields, FALSE); @@ -1145,6 +1194,20 @@ QUICK_RANGE_SELECT::QUICK_RANGE_SELECT(THD *thd, TABLE *table, uint key_nr, } +void QUICK_RANGE_SELECT::need_sorted_output() +{ + if (!(mrr_flags & HA_MRR_SORTED)) + { + /* + Native implementation can't produce sorted output. We'll have to + switch to default + */ + mrr_flags |= HA_MRR_USE_DEFAULT_IMPL; + } + mrr_flags |= HA_MRR_SORTED; +} + + int QUICK_RANGE_SELECT::init() { DBUG_ENTER("QUICK_RANGE_SELECT::init"); @@ -1190,8 +1253,7 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT() my_free((char*) column_bitmap.bitmap, MYF(MY_ALLOW_ZERO_PTR)); } head->column_bitmaps_set(save_read_set, save_write_set); - x_free(multi_range); - x_free(multi_range_buff); + x_free(mrr_buf_desc); DBUG_VOID_RETURN; } @@ -1966,9 +2028,11 @@ class TRP_RANGE : public TABLE_READ_PLAN public: SEL_ARG *key; /* set of intervals to be used in "range" method retrieval */ uint key_idx; /* key number in PARAM::key */ + uint mrr_flags; + uint mrr_buf_size; - TRP_RANGE(SEL_ARG *key_arg, uint idx_arg) - : key(key_arg), key_idx(idx_arg) + TRP_RANGE(SEL_ARG *key_arg, uint idx_arg, uint mrr_flags_arg) + : key(key_arg), key_idx(idx_arg), mrr_flags(mrr_flags_arg) {} virtual ~TRP_RANGE() {} /* Remove gcc warning */ @@ -1977,7 +2041,8 @@ public: { DBUG_ENTER("TRP_RANGE::make_quick"); QUICK_RANGE_SELECT *quick; - if ((quick= get_quick_select(param, key_idx, key, parent_alloc))) + if ((quick= get_quick_select(param, key_idx, key, mrr_flags, + mrr_buf_size, parent_alloc))) { quick->records= records; quick->read_time= read_cost; @@ -2202,7 +2267,8 @@ static int fill_used_fields_bitmap(PARAM *param) int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, table_map prev_tables, - ha_rows limit, bool force_quick_range) + ha_rows limit, bool force_quick_range, + bool ordered_output) { uint idx; double scan_time; @@ -2260,6 +2326,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, param.imerge_cost_buff_size= 0; param.using_real_indexes= TRUE; param.remove_jump_scans= TRUE; + param.force_default_mrr= ordered_output; thd->no_errors=1; // Don't warn about NULL init_sql_alloc(&alloc, thd->variables.range_alloc_block_size, 0); @@ -2313,9 +2380,10 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, if (!head->covering_keys.is_clear_all()) { int key_for_use= find_shortest_key(head, &head->covering_keys); - double key_read_time= (get_index_only_read_time(¶m, records, - key_for_use) + - (double) records / TIME_FOR_COMPARE); + double key_read_time= + param.table->file->index_only_read_time(key_for_use, + rows2double(records)) + + (double) records / TIME_FOR_COMPARE; DBUG_PRINT("info", ("'all'+'using index' scan will be using key %d, " "read time %g", key_for_use, key_read_time)); if (key_read_time < read_time) @@ -3937,42 +4005,6 @@ skip_to_ror_scan: } -/* - Calculate cost of 'index only' scan for given index and number of records. - - SYNOPSIS - get_index_only_read_time() - param parameters structure - records #of records to read - keynr key to read - - NOTES - It is assumed that we will read trough the whole key range and that all - key blocks are half full (normally things are much better). It is also - assumed that each time we read the next key from the index, the handler - performs a random seek, thus the cost is proportional to the number of - blocks read. - - TODO: - Move this to handler->read_time() by adding a flag 'index-only-read' to - this call. The reason for doing this is that the current function doesn't - handle the case when the row is stored in the b-tree (like in innodb - clustered index) -*/ - -static double get_index_only_read_time(const PARAM* param, ha_rows records, - int keynr) -{ - double read_time; - uint keys_per_block= (param->table->file->stats.block_size/2/ - (param->table->key_info[keynr].key_length+ - param->table->file->ref_length) + 1); - read_time=((double) (records+keys_per_block-1)/ - (double) keys_per_block); - return read_time; -} - - typedef struct st_ror_scan_info { uint idx; /* # of used key in param->keys */ @@ -4048,9 +4080,9 @@ ROR_SCAN_INFO *make_ror_scan(const PARAM *param, int idx, SEL_ARG *sel_arg) if (bitmap_is_set(¶m->needed_fields, key_part->fieldnr-1)) bitmap_set_bit(&ror_scan->covered_fields, key_part->fieldnr-1); } + double rows= rows2double(param->table->quick_rows[ror_scan->keynr]); ror_scan->index_read_cost= - get_index_only_read_time(param, param->table->quick_rows[ror_scan->keynr], - ror_scan->keynr); + param->table->file->index_only_read_time(ror_scan->keynr, rows); DBUG_RETURN(ror_scan); } @@ -4837,9 +4869,11 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, bool update_tbl_stats, double read_time) { - int idx; + uint idx; SEL_ARG **key,**end, **key_to_read= NULL; ha_rows UNINIT_VAR(best_records); /* protected by key_to_read */ + uint UNINIT_VAR(best_mrr_flags), /* protected by key_to_read */ + UNINIT_VAR(best_buf_size); /* protected by key_to_read */ TRP_RANGE* read_plan= NULL; bool pk_is_clustered= param->table->file->primary_key_is_clustered(); DBUG_ENTER("get_key_scans_params"); @@ -4852,64 +4886,40 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, "tree scans");); tree->ror_scans_map.clear_all(); tree->n_ror_scans= 0; - for (idx= 0,key=tree->keys, end=key+param->keys; - key != end ; - key++,idx++) + for (idx= 0,key=tree->keys, end=key+param->keys; key != end; key++,idx++) { - ha_rows found_records; - double found_read_time; if (*key) { + ha_rows found_records; + COST_VECT cost; + double found_read_time; + uint mrr_flags, buf_size; uint keynr= param->real_keynr[idx]; if ((*key)->type == SEL_ARG::MAYBE_KEY || (*key)->maybe_flag) param->needed_reg->set_bit(keynr); - bool read_index_only= index_read_must_be_used ? TRUE : - (bool) param->table->covering_keys.is_set(keynr); + bool read_index_only= index_read_must_be_used || + param->table->covering_keys.is_set(keynr); - found_records= check_quick_select(param, idx, *key, update_tbl_stats); - if (param->is_ror_scan) + found_records= check_quick_select(param, idx, read_index_only, *key, + update_tbl_stats, &mrr_flags, + &buf_size, &cost); + + if ((found_records != HA_POS_ERROR) && param->is_ror_scan) { tree->n_ror_scans++; tree->ror_scans_map.set_bit(idx); } - double cpu_cost= (double) found_records / TIME_FOR_COMPARE; - if (found_records != HA_POS_ERROR && found_records > 2 && - read_index_only && - (param->table->file->index_flags(keynr, param->max_key_part,1) & - HA_KEYREAD_ONLY) && - !(pk_is_clustered && keynr == param->table->s->primary_key)) - { - /* - We can resolve this by only reading through this key. - 0.01 is added to avoid races between range and 'index' scan. - */ - found_read_time= get_index_only_read_time(param,found_records,keynr) + - cpu_cost + 0.01; - } - else - { - /* - cost(read_through_index) = cost(disk_io) + cost(row_in_range_checks) - The row_in_range check is in QUICK_RANGE_SELECT::cmp_next function. - */ - found_read_time= param->table->file->read_time(keynr, - param->range_count, - found_records) + - cpu_cost + 0.01; - } - DBUG_PRINT("info",("key %s: found_read_time: %g (cur. read_time: %g)", - param->table->key_info[keynr].name, found_read_time, - read_time)); - - if (read_time > found_read_time && found_records != HA_POS_ERROR) + if (found_records != HA_POS_ERROR && + read_time > (found_read_time= cost.total_cost())) { read_time= found_read_time; best_records= found_records; key_to_read= key; + best_mrr_flags= mrr_flags; + best_buf_size= buf_size; } - } } @@ -4918,11 +4928,13 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, if (key_to_read) { idx= key_to_read - tree->keys; - if ((read_plan= new (param->mem_root) TRP_RANGE(*key_to_read, idx))) + if ((read_plan= new (param->mem_root) TRP_RANGE(*key_to_read, idx, + best_mrr_flags))) { read_plan->records= best_records; read_plan->is_ror= tree->ror_scans_map.is_set(idx); read_plan->read_cost= read_time; + read_plan->mrr_buf_size= best_buf_size; DBUG_PRINT("info", ("Returning range plan for key %s, cost %g, records %lu", param->table->key_info[param->real_keynr[idx]].name, @@ -4985,7 +4997,9 @@ QUICK_SELECT_I *TRP_ROR_INTERSECT::make_quick(PARAM *param, for (; first_scan != last_scan;++first_scan) { if (!(quick= get_quick_select(param, (*first_scan)->idx, - (*first_scan)->sel_arg, alloc)) || + (*first_scan)->sel_arg, + HA_MRR_USE_DEFAULT_IMPL | HA_MRR_SORTED, + 0, alloc)) || quick_intrsect->push_quick_back(quick)) { delete quick_intrsect; @@ -4995,7 +5009,9 @@ QUICK_SELECT_I *TRP_ROR_INTERSECT::make_quick(PARAM *param, if (cpk_scan) { if (!(quick= get_quick_select(param, cpk_scan->idx, - cpk_scan->sel_arg, alloc))) + cpk_scan->sel_arg, + HA_MRR_USE_DEFAULT_IMPL | HA_MRR_SORTED, + 0, alloc))) { delete quick_intrsect; DBUG_RETURN(NULL); @@ -7266,250 +7282,260 @@ void SEL_ARG::test_use_count(SEL_ARG *root) #endif +/**************************************************************************** + MRR Range Sequence Interface implementation that walks a SEL_ARG* tree. + ****************************************************************************/ + +/* MRR range sequence, SEL_ARG* implementation: stack entry */ +typedef struct st_range_seq_entry +{ + /* + Pointers in min and max keys. They point to right-after-end of key + images. The 0-th entry has these pointing to key tuple start. + */ + uchar *min_key, *max_key; + + /* + Flags, for {keypart0, keypart1, ... this_keypart} subtuple. + min_key_flag may have NULL_RANGE set. + */ + uint min_key_flag, max_key_flag; + + /* Number of key parts */ + uint min_key_parts, max_key_parts; + SEL_ARG *key_tree; +} RANGE_SEQ_ENTRY; + /* - Calculate estimate of number records that will be retrieved by a range - scan on given index using given SEL_ARG intervals tree. - SYNOPSIS - check_quick_select - param Parameter from test_quick_select - idx Number of index to use in tree->keys - tree Transformed selection condition, tree->keys[idx] - holds the range tree to be used for scanning. - update_tbl_stats If true, update table->quick_keys with information - about range scan we've evaluated. + MRR range sequence, SEL_ARG* implementation: SEL_ARG graph traversal context +*/ +typedef struct st_sel_arg_range_seq +{ + uint keyno; /* index of used tree in SEL_TREE structure */ + uint real_keyno; /* Number of the index in tables */ + PARAM *param; + SEL_ARG *start; /* Root node of the traversed SEL_ARG* graph */ + + RANGE_SEQ_ENTRY stack[MAX_REF_PARTS]; + int i; /* Index of last used element in the above array */ + + bool at_start; /* TRUE <=> The traversal has just started */ +} SEL_ARG_RANGE_SEQ; - NOTES - param->is_ror_scan is set to reflect if the key scan is a ROR (see - is_key_scan_ror function for more info) - param->table->quick_*, param->range_count (and maybe others) are - updated with data of given key scan, see check_quick_keys for details. - RETURN - Estimate # of records to be retrieved. - HA_POS_ERROR if estimate calculation failed due to table handler problems. +/* + Range sequence interface, SEL_ARG* implementation: Initialize the traversal + + SYNOPSIS + init() + init_params SEL_ARG tree traversal context + n_ranges [ignored] The number of ranges obtained + flags [ignored] HA_MRR_SINGLE_POINT, HA_MRR_FIXED_KEY + RETURN + Value of init_param */ -static ha_rows -check_quick_select(PARAM *param,uint idx,SEL_ARG *tree, bool update_tbl_stats) +range_seq_t sel_arg_range_seq_init(void *init_param, uint n_ranges, uint flags) { - ha_rows records; - bool cpk_scan; - uint key; - DBUG_ENTER("check_quick_select"); + SEL_ARG_RANGE_SEQ *seq= (SEL_ARG_RANGE_SEQ*)init_param; + seq->at_start= TRUE; + seq->stack[0].key_tree= NULL; + seq->stack[0].min_key= seq->param->min_key; + seq->stack[0].min_key_flag= 0; + seq->stack[0].min_key_parts= 0; - param->is_ror_scan= FALSE; - param->first_null_comp= 0; + seq->stack[0].max_key= seq->param->max_key; + seq->stack[0].max_key_flag= 0; + seq->stack[0].max_key_parts= 0; + seq->i= 0; + return init_param; +} - if (!tree) - DBUG_RETURN(HA_POS_ERROR); // Can't use it - param->max_key_part=0; - param->range_count=0; - key= param->real_keynr[idx]; - if (tree->type == SEL_ARG::IMPOSSIBLE) - DBUG_RETURN(0L); // Impossible select. return - if (tree->type != SEL_ARG::KEY_RANGE || tree->part != 0) - DBUG_RETURN(HA_POS_ERROR); // Don't use tree +static void step_down_to(SEL_ARG_RANGE_SEQ *arg, SEL_ARG *key_tree) +{ + RANGE_SEQ_ENTRY *cur= &arg->stack[arg->i+1]; + RANGE_SEQ_ENTRY *prev= &arg->stack[arg->i]; + + cur->key_tree= key_tree; + cur->min_key= prev->min_key; + cur->max_key= prev->max_key; + cur->min_key_parts= prev->min_key_parts; + cur->max_key_parts= prev->max_key_parts; - enum ha_key_alg key_alg= param->table->key_info[key].algorithm; - if ((key_alg != HA_KEY_ALG_BTREE) && (key_alg!= HA_KEY_ALG_UNDEF)) - { - /* Records are not ordered by rowid for other types of indexes. */ - cpk_scan= FALSE; - } - else - { - /* - Clustered PK scan is a special case, check_quick_keys doesn't recognize - CPK scans as ROR scans (while actually any CPK scan is a ROR scan). - */ - cpk_scan= ((param->table->s->primary_key == param->real_keynr[idx]) && - param->table->file->primary_key_is_clustered()); - param->is_ror_scan= !cpk_scan; - } - param->n_ranges= 0; + uint16 stor_length= arg->param->key[arg->keyno][key_tree->part].store_length; + cur->min_key_parts += key_tree->store_min(stor_length, &cur->min_key, + prev->min_key_flag); + cur->max_key_parts += key_tree->store_max(stor_length, &cur->max_key, + prev->max_key_flag); - records= check_quick_keys(param, idx, tree, - param->min_key, 0, -1, - param->max_key, 0, -1); - if (records != HA_POS_ERROR) - { - if (update_tbl_stats) - { - param->table->quick_keys.set_bit(key); - param->table->quick_key_parts[key]=param->max_key_part+1; - param->table->quick_n_ranges[key]= param->n_ranges; - param->table->quick_condition_rows= - min(param->table->quick_condition_rows, records); - } - /* - Need to save quick_rows in any case as it is used when calculating - cost of ROR intersection: - */ - param->table->quick_rows[key]=records; - if (cpk_scan) - param->is_ror_scan= TRUE; - } - if (param->table->file->index_flags(key, 0, TRUE) & HA_KEY_SCAN_NOT_ROR) - param->is_ror_scan= FALSE; - DBUG_PRINT("exit", ("Records: %lu", (ulong) records)); - DBUG_RETURN(records); + cur->min_key_flag= prev->min_key_flag | key_tree->min_flag; + cur->max_key_flag= prev->max_key_flag | key_tree->max_flag; + + if (key_tree->is_null_interval()) + cur->min_key_flag |= NULL_RANGE; + (arg->i)++; } /* - Recursively calculate estimate of # rows that will be retrieved by - key scan on key idx. + Range sequence interface, SEL_ARG* implementation: get the next interval + SYNOPSIS - check_quick_keys() - param Parameter from test_quick select function. - idx Number of key to use in PARAM::keys in list of used keys - (param->real_keynr[idx] holds the key number in table) - key_tree SEL_ARG tree being examined. - min_key Buffer with partial min key value tuple - min_key_flag - max_key Buffer with partial max key value tuple - max_key_flag - - NOTES - The function does the recursive descent on the tree via SEL_ARG::left, - SEL_ARG::right, and SEL_ARG::next_key_part edges. The #rows estimates - are calculated using records_in_range calls at the leaf nodes and then - summed. - - param->min_key and param->max_key are used to hold prefixes of key value - tuples. - - The side effects are: - - param->max_key_part is updated to hold the maximum number of key parts used - in scan minus 1. + sel_arg_range_seq_next() + rseq Value returned from sel_arg_range_seq_init + range OUT Store information about the range here - param->range_count is incremented if the function finds a range that - wasn't counted by the caller. + DESCRIPTION + This is "get_next" function for Range sequence interface implementation + for SEL_ARG* tree. - param->is_ror_scan is cleared if the function detects that the key scan is - not a Rowid-Ordered Retrieval scan ( see comments for is_key_scan_ror - function for description of which key scans are ROR scans) + IMPLEMENTATION + The traversal also updates those param members: + - is_ror_scan + - range_count + - max_key_part RETURN - #records E(#records) for given subtree - HA_POS_ERROR if subtree cannot be used for record retrieval - + 0 Ok + 1 No more ranges in the sequence */ -static ha_rows -check_quick_keys(PARAM *param, uint idx, SEL_ARG *key_tree, - uchar *min_key, uint min_key_flag, int min_keypart, - uchar *max_key, uint max_key_flag, int max_keypart) +//psergey-merge-todo: support check_quick_keys:max_keypart +uint sel_arg_range_seq_next(range_seq_t rseq, KEY_MULTI_RANGE *range) { - ha_rows records=0, tmp; - uint tmp_min_flag, tmp_max_flag, keynr, min_key_length, max_key_length; - uint tmp_min_keypart= min_keypart, tmp_max_keypart= max_keypart; - uchar *tmp_min_key, *tmp_max_key; - uint8 save_first_null_comp= param->first_null_comp; - - param->max_key_part=max(param->max_key_part,key_tree->part); - if (key_tree->left != &null_element) + SEL_ARG *key_tree; + SEL_ARG_RANGE_SEQ *seq= (SEL_ARG_RANGE_SEQ*)rseq; + if (seq->at_start) { - /* - There are at least two intervals for current key part, i.e. condition - was converted to something like - (keyXpartY less/equals c1) OR (keyXpartY more/equals c2). - This is not a ROR scan if the key is not Clustered Primary Key. - */ - param->is_ror_scan= FALSE; - records=check_quick_keys(param, idx, key_tree->left, - min_key, min_key_flag, min_keypart, - max_key, max_key_flag, max_keypart); - if (records == HA_POS_ERROR) // Impossible - return records; + key_tree= seq->start; + seq->at_start= FALSE; + goto walk_up_n_right; } - tmp_min_key= min_key; - tmp_max_key= max_key; - tmp_min_keypart+= key_tree->store_min(param->key[idx][key_tree->part].store_length, - &tmp_min_key, min_key_flag); - tmp_max_keypart+= key_tree->store_max(param->key[idx][key_tree->part].store_length, - &tmp_max_key, max_key_flag); - min_key_length= (uint) (tmp_min_key - param->min_key); - max_key_length= (uint) (tmp_max_key - param->max_key); - - if (param->is_ror_scan) + key_tree= seq->stack[seq->i].key_tree; + /* Ok, we're at some "full tuple" position in the tree */ + + /* Step down if we can */ + if (key_tree->next && key_tree->next != &null_element) { - /* - If the index doesn't cover entire key, mark the scan as non-ROR scan. - Actually we're cutting off some ROR scans here. - */ - uint16 fieldnr= param->table->key_info[param->real_keynr[idx]]. - key_part[key_tree->part].fieldnr - 1; - if (param->table->field[fieldnr]->key_length() != - param->key[idx][key_tree->part].length) - param->is_ror_scan= FALSE; + //step down; (update the tuple, we'll step right and stay there) + seq->i--; + step_down_to(seq, key_tree->next); + key_tree= key_tree->next; + seq->param->is_ror_scan= FALSE; + goto walk_right_n_up; } - if (!param->first_null_comp && key_tree->is_null_interval()) - param->first_null_comp= key_tree->part+1; + /* Ok, can't step down, walk left until we can step down */ + while (1) + { + if (seq->i == 1) // can't step left + return 1; + /* Step left */ + seq->i--; + key_tree= seq->stack[seq->i].key_tree; - if (key_tree->next_key_part && - key_tree->next_key_part->part == key_tree->part+1 && - key_tree->next_key_part->type == SEL_ARG::KEY_RANGE) - { // const key as prefix - if (min_key_length == max_key_length && - !memcmp(min_key, max_key, (uint) (tmp_max_key - max_key)) && - !key_tree->min_flag && !key_tree->max_flag) - { - tmp=check_quick_keys(param,idx,key_tree->next_key_part, tmp_min_key, - min_key_flag | key_tree->min_flag, tmp_min_keypart, - tmp_max_key, max_key_flag | key_tree->max_flag, - tmp_max_keypart); - goto end; // Ugly, but efficient - } - else + /* Step down if we can */ + if (key_tree->next && key_tree->next != &null_element) { - /* The interval for current key part is not c1 <= keyXpartY <= c1 */ - param->is_ror_scan= FALSE; + // Step down; update the tuple + seq->i--; + step_down_to(seq, key_tree->next); + key_tree= key_tree->next; + break; } - - tmp_min_flag=key_tree->min_flag; - tmp_max_flag=key_tree->max_flag; - if (!tmp_min_flag) - tmp_min_keypart+= - key_tree->next_key_part->store_min_key(param->key[idx], &tmp_min_key, - &tmp_min_flag); - if (!tmp_max_flag) - tmp_max_keypart+= - key_tree->next_key_part->store_max_key(param->key[idx], &tmp_max_key, - &tmp_max_flag); - min_key_length= (uint) (tmp_min_key - param->min_key); - max_key_length= (uint) (tmp_max_key - param->max_key); } - else + + /* + Ok, we've stepped down from the path to previous tuple. + Walk right-up while we can + */ +walk_right_n_up: + while (key_tree->next_key_part && key_tree->next_key_part != &null_element && + key_tree->next_key_part->part == key_tree->part + 1 && + key_tree->next_key_part->type == SEL_ARG::KEY_RANGE) { - tmp_min_flag= min_key_flag | key_tree->min_flag; - tmp_max_flag= max_key_flag | key_tree->max_flag; + { + RANGE_SEQ_ENTRY *cur= &seq->stack[seq->i]; + uint min_key_length= cur->min_key - seq->param->min_key; + uint max_key_length= cur->max_key - seq->param->max_key; + uint len= cur->min_key - cur[-1].min_key; + if (!(min_key_length == max_key_length && + !memcmp(cur[-1].min_key, cur[-1].max_key, len) && + !key_tree->min_flag && !key_tree->max_flag)) + { + seq->param->is_ror_scan= FALSE; + if (!key_tree->min_flag) + cur->min_key_parts += + key_tree->next_key_part->store_min_key(seq->param->key[seq->keyno], + &cur->min_key, + &cur->min_key_flag); + if (!key_tree->max_flag) + cur->max_key_parts += + key_tree->next_key_part->store_max_key(seq->param->key[seq->keyno], + &cur->max_key, + &cur->max_key_flag); + break; + } + } + + /* + Ok, current atomic interval is in form "t.field=const" and there is + next_key_part interval. Step right, and walk up from there. + */ + key_tree= key_tree->next_key_part; + +walk_up_n_right: + while (key_tree->prev && key_tree->prev != &null_element) + { + /* Step up */ + key_tree= key_tree->prev; + } + step_down_to(seq, key_tree); } - if (unlikely(param->thd->killed != 0)) - return HA_POS_ERROR; + /* Ok got a tuple */ + RANGE_SEQ_ENTRY *cur= &seq->stack[seq->i]; + uint min_key_length= cur->min_key - seq->param->min_key; - keynr=param->real_keynr[idx]; - param->range_count++; - if (!tmp_min_flag && ! tmp_max_flag && - (uint) key_tree->part+1 == param->table->key_info[keynr].key_parts && - (param->table->key_info[keynr].flags & (HA_NOSAME | HA_END_SPACE_KEY)) == - HA_NOSAME && min_key_length == max_key_length && - !memcmp(param->min_key, param->max_key, min_key_length) && - !param->first_null_comp) - { - tmp=1; // Max one record - param->n_ranges++; + range->ptr= (char*)(int)(key_tree->part); + if (cur->min_key_flag & GEOM_FLAG) + { + range->range_flag= cur->min_key_flag; + + /* Here minimum contains also function code bits, and maximum is +inf */ + range->start_key.key= seq->param->min_key; + range->start_key.length= min_key_length; + range->start_key.flag= (ha_rkey_function) (cur->min_key_flag ^ GEOM_FLAG); } else { - if (param->is_ror_scan) + range->range_flag= cur->min_key_flag | cur->max_key_flag; + + range->start_key.key= seq->param->min_key; + range->start_key.length= cur->min_key - seq->param->min_key; + range->start_key.keypart_map= make_prev_keypart_map(cur->min_key_parts); + range->start_key.flag= (cur->min_key_flag & NEAR_MIN ? HA_READ_AFTER_KEY : + HA_READ_KEY_EXACT); + + range->end_key.key= seq->param->max_key; + range->end_key.length= cur->max_key - seq->param->max_key; + range->end_key.flag= (cur->max_key_flag & NEAR_MAX ? HA_READ_BEFORE_KEY : + HA_READ_AFTER_KEY); + range->end_key.keypart_map= make_prev_keypart_map(cur->max_key_parts); + + if (!(cur->min_key_flag & ~NULL_RANGE) && !cur->max_key_flag && + (uint)key_tree->part+1 == seq->param->table->key_info[seq->real_keyno].key_parts && + (seq->param->table->key_info[seq->real_keyno].flags & (HA_NOSAME | HA_END_SPACE_KEY)) == + HA_NOSAME && + range->start_key.length == range->end_key.length && + !memcmp(seq->param->min_key,seq->param->max_key,range->start_key.length)) + range->range_flag= UNIQUE_RANGE | (cur->min_key_flag & NULL_RANGE); + + if (seq->param->is_ror_scan) { /* If we get here, the condition on the key was converted to form @@ -7520,69 +7546,137 @@ check_quick_keys(PARAM *param, uint idx, SEL_ARG *key_tree, uncovered "tail" of KeyX parts is either empty or is identical to first members of clustered primary key. */ - if (!(min_key_length == max_key_length && - !memcmp(min_key, max_key, (uint) (tmp_max_key - max_key)) && - !key_tree->min_flag && !key_tree->max_flag && - is_key_scan_ror(param, keynr, key_tree->part + 1))) - param->is_ror_scan= FALSE; + if (!(!(cur->min_key_flag & ~NULL_RANGE) && !cur->max_key_flag && + (range->start_key.length == range->end_key.length) && + !memcmp(range->start_key.key, range->end_key.key, range->start_key.length) && + is_key_scan_ror(seq->param, seq->real_keyno, key_tree->part + 1))) + seq->param->is_ror_scan= FALSE; } - param->n_ranges++; + } + seq->param->range_count++; + seq->param->max_key_part=max(seq->param->max_key_part,key_tree->part); + return 0; +} - if (tmp_min_flag & GEOM_FLAG) - { - key_range min_range; - min_range.key= param->min_key; - min_range.length= min_key_length; - min_range.keypart_map= make_keypart_map(tmp_min_keypart); - /* In this case tmp_min_flag contains the handler-read-function */ - min_range.flag= (ha_rkey_function) (tmp_min_flag ^ GEOM_FLAG); - tmp= param->table->file->records_in_range(keynr, - &min_range, (key_range*) 0); - } - else +/* + Calculate cost and E(#rows) for a given index and intervals tree + + SYNOPSIS + check_quick_select() + param Parameter from test_quick_select + idx Number of index to use in PARAM::key SEL_TREE::key + index_only TRUE - assume only index tuples will be accessed + FALSE - assume full table rows will be read + tree Transformed selection condition, tree->key[idx] holds + the intervals for the given index. + update_tbl_stats TRUE <=> update table->quick_* with information + about range scan we've evaluated. + mrr_flags INOUT MRR access flags + cost OUT Scan cost + + NOTES + param->is_ror_scan is set to reflect if the key scan is a ROR (see + is_key_scan_ror function for more info) + param->table->quick_*, param->range_count (and maybe others) are + updated with data of given key scan, see quick_range_seq_next for details. + + RETURN + Estimate # of records to be retrieved. + HA_POS_ERROR if estimate calculation failed due to table handler problems. +*/ + +static +ha_rows check_quick_select(PARAM *param, uint idx, bool index_only, + SEL_ARG *tree, bool update_tbl_stats, + uint *mrr_flags, uint *bufsize, COST_VECT *cost) +{ + SEL_ARG_RANGE_SEQ seq; + RANGE_SEQ_IF seq_if = {sel_arg_range_seq_init, sel_arg_range_seq_next, 0, 0}; + handler *file= param->table->file; + ha_rows rows; + uint keynr= param->real_keynr[idx]; + DBUG_ENTER("check_quick_select"); + + /* Handle cases when we don't have a valid non-empty list of range */ + if (!tree) + DBUG_RETURN(HA_POS_ERROR); + if (tree->type == SEL_ARG::IMPOSSIBLE) + DBUG_RETURN(0L); + if (tree->type != SEL_ARG::KEY_RANGE || tree->part != 0) + DBUG_RETURN(HA_POS_ERROR); + + seq.keyno= idx; + seq.real_keyno= keynr; + seq.param= param; + seq.start= tree; + + param->range_count=0; + param->max_key_part=0; + + param->is_ror_scan= TRUE; + if (file->index_flags(keynr, 0, TRUE) & HA_KEY_SCAN_NOT_ROR) + param->is_ror_scan= FALSE; + + *mrr_flags= param->force_default_mrr? HA_MRR_USE_DEFAULT_IMPL: 0; + /* + Pass HA_MRR_SORTED to see if MRR implementation can handle sorting. + */ + *mrr_flags|= HA_MRR_NO_ASSOCIATION | HA_MRR_SORTED; + + bool pk_is_clustered= file->primary_key_is_clustered(); + if (index_only && + (file->index_flags(keynr, param->max_key_part, 1) & HA_KEYREAD_ONLY) && + !(pk_is_clustered && keynr == param->table->s->primary_key)) + *mrr_flags |= HA_MRR_INDEX_ONLY; + + if (current_thd->lex->sql_command != SQLCOM_SELECT) + *mrr_flags |= HA_MRR_USE_DEFAULT_IMPL; + + *bufsize= param->thd->variables.read_rnd_buff_size; + rows= file->multi_range_read_info_const(keynr, &seq_if, (void*)&seq, 0, + bufsize, mrr_flags, cost); + if (rows != HA_POS_ERROR) + { + param->table->quick_rows[keynr]=rows; + if (update_tbl_stats) { - key_range min_range, max_range; - - min_range.key= param->min_key; - min_range.length= min_key_length; - min_range.flag= (tmp_min_flag & NEAR_MIN ? HA_READ_AFTER_KEY : - HA_READ_KEY_EXACT); - min_range.keypart_map= make_keypart_map(tmp_min_keypart); - max_range.key= param->max_key; - max_range.length= max_key_length; - max_range.flag= (tmp_max_flag & NEAR_MAX ? - HA_READ_BEFORE_KEY : HA_READ_AFTER_KEY); - max_range.keypart_map= make_keypart_map(tmp_max_keypart); - tmp=param->table->file->records_in_range(keynr, - (min_key_length ? &min_range : - (key_range*) 0), - (max_key_length ? &max_range : - (key_range*) 0)); + param->table->quick_keys.set_bit(keynr); + param->table->quick_key_parts[keynr]=param->max_key_part+1; + param->table->quick_n_ranges[keynr]= param->range_count; + param->table->quick_condition_rows= + min(param->table->quick_condition_rows, rows); } } - end: - if (tmp == HA_POS_ERROR) // Impossible range - return tmp; - records+=tmp; - if (key_tree->right != &null_element) + /* Figure out if the key scan is ROR (returns rows in ROWID order) or not */ + enum ha_key_alg key_alg= param->table->key_info[seq.real_keyno].algorithm; + if ((key_alg != HA_KEY_ALG_BTREE) && (key_alg!= HA_KEY_ALG_UNDEF)) { - /* - There are at least two intervals for current key part, i.e. condition - was converted to something like - (keyXpartY less/equals c1) OR (keyXpartY more/equals c2). - This is not a ROR scan if the key is not Clustered Primary Key. + /* + All scans are non-ROR scans for those index types. + TODO: Don't have this logic here, make table engines return + appropriate flags instead. + */ + param->is_ror_scan= FALSE; + } + else if (param->table->s->primary_key == keynr && pk_is_clustered) + { + /* Clustered PK scan is always a ROR scan (TODO: same as above) */ + param->is_ror_scan= TRUE; + } + else if (param->range_count > 1) + { + /* + Scaning multiple key values in the index: the records are ROR + for each value, but not between values. E.g, "SELECT ... x IN + (1,3)" returns ROR order for all records with x=1, then ROR + order for records with x=3 */ param->is_ror_scan= FALSE; - tmp=check_quick_keys(param, idx, key_tree->right, - min_key, min_key_flag, min_keypart, - max_key, max_key_flag, max_keypart); - if (tmp == HA_POS_ERROR) - return tmp; - records+=tmp; } - param->first_null_comp= save_first_null_comp; - return records; + + DBUG_PRINT("exit", ("Records: %lu", (ulong) rows)); + DBUG_RETURN(rows); //psergey-merge:todo: maintain first_null_comp. } @@ -7610,13 +7704,14 @@ check_quick_keys(PARAM *param, uint idx, SEL_ARG *key_tree, where the index is defined on (key1_1, ..., key1_N [,a_1, ..., a_n]) and the table has a clustered Primary Key defined as - PRIMARY KEY(a_1, ..., a_n, b1, ..., b_k) i.e. the first key parts of it are identical to uncovered parts ot the key being scanned. This function assumes that the index flags do not include HA_KEY_SCAN_NOT_ROR flag (that is checked elsewhere). + Check (1) is made in quick_range_seq_next() + RETURN TRUE The scan is ROR-scan FALSE Otherwise @@ -7629,9 +7724,19 @@ static bool is_key_scan_ror(PARAM *param, uint keynr, uint8 nparts) KEY_PART_INFO *key_part_end= (table_key->key_part + table_key->key_parts); uint pk_number; + + for (KEY_PART_INFO *kp= table_key->key_part; kp < key_part; kp++) + { + uint16 fieldnr= param->table->key_info[keynr]. + key_part[kp - table_key->key_part].fieldnr - 1; + if (param->table->field[fieldnr]->key_length() != kp->length) + return FALSE; + } if (key_part == key_part_end) return TRUE; + + key_part= table_key->key_part + nparts; pk_number= param->table->s->primary_key; if (!param->table->file->primary_key_is_clustered() || pk_number == MAX_KEY) return FALSE; @@ -7656,12 +7761,14 @@ static bool is_key_scan_ror(PARAM *param, uint keynr, uint8 nparts) SYNOPSIS get_quick_select() param - idx Index of used key in param->key. - key_tree SEL_ARG tree for the used key - parent_alloc If not NULL, use it to allocate memory for - quick select data. Otherwise use quick->alloc. + idx Index of used key in param->key. + key_tree SEL_ARG tree for the used key + mrr_flags MRR parameter for quick select + mrr_buf_size MRR parameter for quick select + parent_alloc If not NULL, use it to allocate memory for + quick select data. Otherwise use quick->alloc. NOTES - The caller must call QUICK_SELECT::init for returned quick select + The caller must call QUICK_SELECT::init for returned quick select. CAUTION! This function may change thd->mem_root to a MEM_ROOT which will be deallocated when the returned quick select is deleted. @@ -7672,25 +7779,26 @@ static bool is_key_scan_ror(PARAM *param, uint keynr, uint8 nparts) */ QUICK_RANGE_SELECT * -get_quick_select(PARAM *param,uint idx,SEL_ARG *key_tree, - MEM_ROOT *parent_alloc) +get_quick_select(PARAM *param,uint idx,SEL_ARG *key_tree, uint mrr_flags, + uint mrr_buf_size, MEM_ROOT *parent_alloc) { QUICK_RANGE_SELECT *quick; + bool create_err= FALSE; DBUG_ENTER("get_quick_select"); if (param->table->key_info[param->real_keynr[idx]].flags & HA_SPATIAL) quick=new QUICK_RANGE_SELECT_GEOM(param->thd, param->table, param->real_keynr[idx], test(parent_alloc), - parent_alloc); + parent_alloc, &create_err); else quick=new QUICK_RANGE_SELECT(param->thd, param->table, param->real_keynr[idx], - test(parent_alloc)); + test(parent_alloc), NULL, &create_err); if (quick) { - if (quick->error || + if (create_err || get_quick_keys(param,quick,param->key[idx],key_tree,param->min_key,0, param->max_key,0)) { @@ -7699,6 +7807,8 @@ get_quick_select(PARAM *param,uint idx,SEL_ARG *key_tree, } else { + quick->mrr_flags= mrr_flags; + quick->mrr_buf_size= mrr_buf_size; quick->key_parts=(KEY_PART*) memdup_root(parent_alloc? parent_alloc : &quick->alloc, (char*) param->key[idx], @@ -7847,7 +7957,20 @@ bool QUICK_RANGE_SELECT::unique_key_range() } -/* Returns TRUE if any part of the key is NULL */ + +/* + Return TRUE if any part of the key is NULL + + SYNOPSIS + null_part_in_key() + key_part Array of key parts (index description) + key Key values tuple + length Length of key values tuple in bytes. + + RETURN + TRUE The tuple has at least one "keypartX is NULL" + FALSE Otherwise +*/ static bool null_part_in_key(KEY_PART *key_part, const uchar *key, uint length) { @@ -7904,6 +8027,19 @@ bool QUICK_ROR_UNION_SELECT::is_keys_used(const MY_BITMAP *fields) } +FT_SELECT *get_ft_select(THD *thd, TABLE *table, uint key) +{ + bool create_err= FALSE; + FT_SELECT *fts= new FT_SELECT(thd, table, key, &create_err); + if (create_err) + { + delete fts; + return NULL; + } + else + return fts; +} + /* Create quick select from ref/ref_or_null scan. @@ -7932,10 +8068,12 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, KEY_PART *key_part; QUICK_RANGE *range; uint part; + bool create_err= FALSE; + COST_VECT cost; old_root= thd->mem_root; /* The following call may change thd->mem_root */ - quick= new QUICK_RANGE_SELECT(thd, table, ref->key, 0); + quick= new QUICK_RANGE_SELECT(thd, table, ref->key, 0, 0, &create_err); /* save mem_root set by QUICK_RANGE_SELECT constructor */ alloc= thd->mem_root; /* @@ -7944,7 +8082,7 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, */ thd->mem_root= old_root; - if (!quick) + if (!quick || create_err) return 0; /* no ranges found */ if (quick->init()) goto err; @@ -7999,8 +8137,24 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, goto err; } - return quick; + /* Call multi_range_read_info() to get the MRR flags and buffer size */ + quick->mrr_flags= HA_MRR_NO_ASSOCIATION | + (table->key_read ? HA_MRR_INDEX_ONLY : 0); + if (thd->lex->sql_command != SQLCOM_SELECT) + quick->mrr_flags |= HA_MRR_USE_DEFAULT_IMPL; +#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE + if (!ref->null_ref_key && !key_has_nulls(key_info, range->min_key, + ref->key_length)) + quick->mrr_flags |= HA_MRR_NO_NULL_ENDPOINTS; +#endif + quick->mrr_buf_size= thd->variables.read_rnd_buff_size; + if (table->file->multi_range_read_info(quick->index, 1, (uint)records, + &quick->mrr_buf_size, + &quick->mrr_flags, &cost)) + goto err; + + return quick; err: delete quick; return 0; @@ -8312,80 +8466,123 @@ int QUICK_ROR_UNION_SELECT::get_next() int QUICK_RANGE_SELECT::reset() { - uint mrange_bufsiz; + uint buf_size; uchar *mrange_buff; + int error; + HANDLER_BUFFER empty_buf; DBUG_ENTER("QUICK_RANGE_SELECT::reset"); - next=0; last_range= NULL; - in_range= FALSE; cur_range= (QUICK_RANGE**) ranges.buffer; if (file->inited == handler::NONE && (error= file->ha_index_init(index,1))) DBUG_RETURN(error); - /* Do not allocate the buffers twice. */ - if (multi_range_length) - { - DBUG_ASSERT(multi_range_length == min(multi_range_count, ranges.elements)); - DBUG_RETURN(0); - } - - /* Allocate the ranges array. */ - DBUG_ASSERT(ranges.elements); - multi_range_length= min(multi_range_count, ranges.elements); - DBUG_ASSERT(multi_range_length > 0); - while (multi_range_length && ! (multi_range= (KEY_MULTI_RANGE*) - my_malloc(multi_range_length * - sizeof(KEY_MULTI_RANGE), - MYF(MY_WME)))) - { - /* Try to shrink the buffers until it is 0. */ - multi_range_length/= 2; - } - if (! multi_range) - { - multi_range_length= 0; - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - - /* Allocate the handler buffer if necessary. */ - if (file->ha_table_flags() & HA_NEED_READ_RANGE_BUFFER) + /* Allocate buffer if we need one but haven't allocated it yet */ + if (mrr_buf_size && !mrr_buf_desc) { - mrange_bufsiz= min(multi_range_bufsiz, - ((uint)QUICK_SELECT_I::records + 1)* head->s->reclength); - - while (mrange_bufsiz && - ! my_multi_malloc(MYF(MY_WME), - &multi_range_buff, - (uint) sizeof(*multi_range_buff), - &mrange_buff, (uint) mrange_bufsiz, - NullS)) + buf_size= mrr_buf_size; + while (buf_size && !my_multi_malloc(MYF(MY_WME), + &mrr_buf_desc, sizeof(*mrr_buf_desc), + &mrange_buff, buf_size, + NullS)) { /* Try to shrink the buffers until both are 0. */ - mrange_bufsiz/= 2; + buf_size/= 2; } - if (! multi_range_buff) - { - my_free((char*) multi_range, MYF(0)); - multi_range= NULL; - multi_range_length= 0; + if (!mrr_buf_desc) DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } /* Initialize the handler buffer. */ - multi_range_buff->buffer= mrange_buff; - multi_range_buff->buffer_end= mrange_buff + mrange_bufsiz; - multi_range_buff->end_of_used_area= mrange_buff; -#ifdef HAVE_valgrind + mrr_buf_desc->buffer= mrange_buff; + mrr_buf_desc->buffer_end= mrange_buff + buf_size; + mrr_buf_desc->end_of_used_area= mrange_buff; +#ifdef HAVE_purify /* We need this until ndb will use the buffer efficiently (Now ndb stores complete row in here, instead of only the used fields which gives us valgrind warnings in compare_record[]) */ - bzero((char*) mrange_buff, mrange_bufsiz); + bzero((char*) mrange_buff, buf_size); #endif } - DBUG_RETURN(0); + + if (!mrr_buf_desc) + empty_buf.buffer= empty_buf.buffer_end= empty_buf.end_of_used_area= NULL; + + RANGE_SEQ_IF seq_funcs= {quick_range_seq_init, quick_range_seq_next, 0, 0}; + error= file->multi_range_read_init(&seq_funcs, (void*)this, ranges.elements, + mrr_flags, mrr_buf_desc? mrr_buf_desc: + &empty_buf); + DBUG_RETURN(error); +} + + +/* + Range sequence interface implementation for array<QUICK_RANGE>: initialize + + SYNOPSIS + quick_range_seq_init() + init_param Caller-opaque paramenter: QUICK_RANGE_SELECT* pointer + n_ranges Number of ranges in the sequence (ignored) + flags MRR flags (currently not used) + + RETURN + Opaque value to be passed to quick_range_seq_next +*/ + +range_seq_t quick_range_seq_init(void *init_param, uint n_ranges, uint flags) +{ + QUICK_RANGE_SELECT *quick= (QUICK_RANGE_SELECT*)init_param; + quick->qr_traversal_ctx.first= (QUICK_RANGE**)quick->ranges.buffer; + quick->qr_traversal_ctx.cur= (QUICK_RANGE**)quick->ranges.buffer; + quick->qr_traversal_ctx.last= quick->qr_traversal_ctx.cur + + quick->ranges.elements; + return &quick->qr_traversal_ctx; +} + + +/* + Range sequence interface implementation for array<QUICK_RANGE>: get next + + SYNOPSIS + quick_range_seq_next() + rseq Value returned from quick_range_seq_init + range OUT Store information about the range here + + RETURN + 0 Ok + 1 No more ranges in the sequence +*/ + +uint quick_range_seq_next(range_seq_t rseq, KEY_MULTI_RANGE *range) +{ + QUICK_RANGE_SEQ_CTX *ctx= (QUICK_RANGE_SEQ_CTX*)rseq; + + if (ctx->cur == ctx->last) + return 1; /* no more ranges */ + + QUICK_RANGE *cur= *(ctx->cur); + key_range *start_key= &range->start_key; + key_range *end_key= &range->end_key; + + start_key->key= cur->min_key; + start_key->length= cur->min_length; + start_key->keypart_map= cur->min_keypart_map; + start_key->flag= ((cur->flag & NEAR_MIN) ? HA_READ_AFTER_KEY : + (cur->flag & EQ_RANGE) ? + HA_READ_KEY_EXACT : HA_READ_KEY_OR_NEXT); + end_key->key= cur->max_key; + end_key->length= cur->max_length; + end_key->keypart_map= cur->max_keypart_map; + /* + We use HA_READ_AFTER_KEY here because if we are reading on a key + prefix. We want to find all keys with this prefix. + */ + end_key->flag= (cur->flag & NEAR_MAX ? HA_READ_BEFORE_KEY : + HA_READ_AFTER_KEY); + range->range_flag= cur->flag; + ctx->cur++; + return 0; } @@ -8406,15 +8603,8 @@ int QUICK_RANGE_SELECT::reset() int QUICK_RANGE_SELECT::get_next() { - int result; - KEY_MULTI_RANGE *mrange; - key_range *start_key; - key_range *end_key; + char *dummy; DBUG_ENTER("QUICK_RANGE_SELECT::get_next"); - DBUG_ASSERT(multi_range_length && multi_range && - (cur_range >= (QUICK_RANGE**) ranges.buffer) && - (cur_range <= (QUICK_RANGE**) ranges.buffer + ranges.elements)); - if (in_ror_merged_scan) { /* @@ -8424,63 +8614,8 @@ int QUICK_RANGE_SELECT::get_next() head->column_bitmaps_set_no_signal(&column_bitmap, &column_bitmap); } - for (;;) - { - if (in_range) - { - /* We did already start to read this key. */ - result= file->read_multi_range_next(&mrange); - if (result != HA_ERR_END_OF_FILE) - goto end; - } + int result= file->multi_range_read_next(&dummy); - uint count= min(multi_range_length, ranges.elements - - (cur_range - (QUICK_RANGE**) ranges.buffer)); - if (count == 0) - { - /* Ranges have already been used up before. None is left for read. */ - in_range= FALSE; - if (in_ror_merged_scan) - head->column_bitmaps_set_no_signal(save_read_set, save_write_set); - DBUG_RETURN(HA_ERR_END_OF_FILE); - } - KEY_MULTI_RANGE *mrange_slot, *mrange_end; - for (mrange_slot= multi_range, mrange_end= mrange_slot+count; - mrange_slot < mrange_end; - mrange_slot++) - { - start_key= &mrange_slot->start_key; - end_key= &mrange_slot->end_key; - last_range= *(cur_range++); - - start_key->key= (const uchar*) last_range->min_key; - start_key->length= last_range->min_length; - start_key->flag= ((last_range->flag & NEAR_MIN) ? HA_READ_AFTER_KEY : - (last_range->flag & EQ_RANGE) ? - HA_READ_KEY_EXACT : HA_READ_KEY_OR_NEXT); - start_key->keypart_map= last_range->min_keypart_map; - end_key->key= (const uchar*) last_range->max_key; - end_key->length= last_range->max_length; - /* - We use HA_READ_AFTER_KEY here because if we are reading on a key - prefix. We want to find all keys with this prefix. - */ - end_key->flag= (last_range->flag & NEAR_MAX ? HA_READ_BEFORE_KEY : - HA_READ_AFTER_KEY); - end_key->keypart_map= last_range->max_keypart_map; - - mrange_slot->range_flag= last_range->flag; - } - - result= file->read_multi_range_first(&mrange, multi_range, count, - sorted, multi_range_buff); - if (result != HA_ERR_END_OF_FILE) - goto end; - in_range= FALSE; /* No matching rows; go to next set of ranges. */ - } - -end: - in_range= ! result; if (in_ror_merged_scan) { /* Restore bitmaps set on entry */ @@ -8489,6 +8624,7 @@ end: DBUG_RETURN(result); } + /* Get the next record with a different prefix. @@ -8529,9 +8665,7 @@ int QUICK_RANGE_SELECT::get_next_prefix(uint prefix_length, key_range start_key, end_key; if (last_range) { - /* - Read the next record in the same range with prefix after cur_prefix. - */ + /* Read the next record in the same range with prefix after cur_prefix. */ DBUG_ASSERT(cur_prefix != 0); result= file->ha_index_read_map(record, cur_prefix, keypart_map, HA_READ_AFTER_KEY); @@ -8667,7 +8801,8 @@ bool QUICK_RANGE_SELECT::row_in_ranges() */ QUICK_SELECT_DESC::QUICK_SELECT_DESC(QUICK_RANGE_SELECT *q, - uint used_key_parts_arg) + uint used_key_parts_arg, + bool *create_err) :QUICK_RANGE_SELECT(*q), rev_it(rev_ranges), used_key_parts (used_key_parts_arg) { @@ -8676,9 +8811,9 @@ QUICK_SELECT_DESC::QUICK_SELECT_DESC(QUICK_RANGE_SELECT *q, Use default MRR implementation for reverse scans. No table engine currently can do an MRR scan with output in reverse index order. */ - multi_range_length= 0; - multi_range= NULL; - multi_range_buff= NULL; + mrr_buf_desc= NULL; + mrr_flags |= HA_MRR_USE_DEFAULT_IMPL; + mrr_buf_size= 0; QUICK_RANGE **pr= (QUICK_RANGE**)ranges.buffer; QUICK_RANGE **end_range= pr + ranges.elements; @@ -8787,6 +8922,7 @@ int QUICK_SELECT_DESC::get_next() /* Compare if found key is over max-value Returns 0 if key <= range->max_key + TODO: Figure out why can't this function be as simple as cmp_prev(). */ int QUICK_RANGE_SELECT::cmp_next(QUICK_RANGE *range_arg) @@ -9518,8 +9654,14 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree) cur_index_tree= get_index_range_tree(cur_index, tree, param, &cur_param_idx); /* Check if this range tree can be used for prefix retrieval. */ + COST_VECT dummy_cost; + uint mrr_flags= HA_MRR_USE_DEFAULT_IMPL; + uint mrr_bufsize=0; cur_quick_prefix_records= check_quick_select(param, cur_param_idx, - cur_index_tree, TRUE); + FALSE /*don't care(*/, + cur_index_tree, TRUE, + &mrr_flags, &mrr_bufsize, + &dummy_cost); } cost_group_min_max(table, cur_index_info, cur_used_key_parts, cur_group_key_parts, tree, cur_index_tree, @@ -10103,6 +10245,7 @@ TRP_GROUP_MIN_MAX::make_quick(PARAM *param, bool retrieve_full_rows, /* Make a QUICK_RANGE_SELECT to be used for group prefix retrieval. */ quick->quick_prefix_select= get_quick_select(param, param_idx, index_tree, + HA_MRR_USE_DEFAULT_IMPL, 0, &quick->alloc); /* @@ -11209,6 +11352,7 @@ static void print_ror_scans_arr(TABLE *table, const char *msg, DBUG_VOID_RETURN; } + /***************************************************************************** ** Print a quick range for debugging ** TODO: diff --git a/sql/opt_range.h b/sql/opt_range.h index 6f7ef7842e7..dfd0cdac003 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -114,13 +114,16 @@ class QUICK_RANGE :public Sql_alloc { 4. Delete the select: delete quick; - + + NOTE + quick select doesn't use Sql_alloc/MEM_ROOT allocation because "range + checked for each record" functionality may create/destroy + O(#records_in_some_table) quick selects during query execution. */ class QUICK_SELECT_I { public: - bool sorted; ha_rows records; /* estimate of # of records to be retrieved */ double read_time; /* time to perform this retrieval */ TABLE *head; @@ -193,6 +196,12 @@ public: virtual bool reverse_sorted() = 0; virtual bool unique_key_range() { return false; } + /* + Request that this quick select produces sorted output. Not all quick + selects can do it, the caller is responsible for calling this function + only for those quick selects that can. + */ + virtual void need_sorted_output() = 0; enum { QS_TYPE_RANGE = 0, QS_TYPE_INDEX_MERGE = 1, @@ -272,6 +281,22 @@ struct st_qsel_param; class PARAM; class SEL_ARG; + +/* + MRR range sequence, array<QUICK_RANGE> implementation: sequence traversal + context. +*/ +typedef struct st_quick_range_seq_ctx +{ + QUICK_RANGE **first; + QUICK_RANGE **cur; + QUICK_RANGE **last; +} QUICK_RANGE_SEQ_CTX; + +range_seq_t quick_range_seq_init(void *init_param, uint n_ranges, uint flags); +uint quick_range_seq_next(range_seq_t rseq, KEY_MULTI_RANGE *range); + + /* Quick select that does a range scan on a single key. The records are returned in key order. @@ -279,60 +304,45 @@ class SEL_ARG; class QUICK_RANGE_SELECT : public QUICK_SELECT_I { protected: - bool next,dont_free,in_ror_merged_scan; -public: - int error; -protected: handler *file; - /* - If true, this quick select has its "own" handler object which should be - closed no later then this quick select is deleted. - */ - bool free_file; - bool in_range; - uint multi_range_count; /* copy from thd->variables.multi_range_count */ - uint multi_range_length; /* the allocated length for the array */ - uint multi_range_bufsiz; /* copy from thd->variables.read_rnd_buff_size */ - KEY_MULTI_RANGE *multi_range; /* the multi-range array (allocated and - freed by QUICK_RANGE_SELECT) */ - HANDLER_BUFFER *multi_range_buff; /* the handler buffer (allocated and - freed by QUICK_RANGE_SELECT) */ + + /* Members to deal with case when this quick select is a ROR-merged scan */ + bool in_ror_merged_scan; MY_BITMAP column_bitmap, *save_read_set, *save_write_set; + bool free_file; /* TRUE <=> this->file is "owned" by this quick select */ - friend class TRP_ROR_INTERSECT; - friend - QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, - struct st_table_ref *ref, - ha_rows records); - friend bool get_quick_keys(PARAM *param, - QUICK_RANGE_SELECT *quick,KEY_PART *key, - SEL_ARG *key_tree, - uchar *min_key, uint min_key_flag, - uchar *max_key, uint max_key_flag); - friend QUICK_RANGE_SELECT *get_quick_select(PARAM*,uint idx, - SEL_ARG *key_tree, - MEM_ROOT *alloc); - friend class QUICK_SELECT_DESC; - friend class QUICK_INDEX_MERGE_SELECT; - friend class QUICK_ROR_INTERSECT_SELECT; - friend class QUICK_GROUP_MIN_MAX_SELECT; + /* Range pointers to be used when not using MRR interface */ + /* Members needed to use the MRR interface */ + QUICK_RANGE_SEQ_CTX qr_traversal_ctx; +public: + uint mrr_flags; /* Flags to be used with MRR interface */ +protected: + uint mrr_buf_size; /* copy from thd->variables.read_rnd_buff_size */ + HANDLER_BUFFER *mrr_buf_desc; /* the handler buffer */ + /* Info about index we're scanning */ + DYNAMIC_ARRAY ranges; /* ordered array of range ptrs */ QUICK_RANGE **cur_range; /* current element in ranges */ - + QUICK_RANGE *last_range; + KEY_PART *key_parts; KEY_PART_INFO *key_part_info; + + bool dont_free; /* Used by QUICK_SELECT_DESC */ + int cmp_next(QUICK_RANGE *range); int cmp_prev(QUICK_RANGE *range); bool row_in_ranges(); public: MEM_ROOT alloc; - QUICK_RANGE_SELECT(THD *thd, TABLE *table,uint index_arg,bool no_alloc=0, - MEM_ROOT *parent_alloc=NULL); + QUICK_RANGE_SELECT(THD *thd, TABLE *table,uint index_arg,bool no_alloc, + MEM_ROOT *parent_alloc, bool *create_err); ~QUICK_RANGE_SELECT(); - + + void need_sorted_output(); int init(); int reset(void); int get_next(); @@ -352,6 +362,27 @@ public: #endif private: /* Default copy ctor used by QUICK_SELECT_DESC */ + friend class TRP_ROR_INTERSECT; + friend + QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, + struct st_table_ref *ref, + ha_rows records); + friend bool get_quick_keys(PARAM *param, QUICK_RANGE_SELECT *quick, + KEY_PART *key, SEL_ARG *key_tree, + uchar *min_key, uint min_key_flag, + uchar *max_key, uint max_key_flag); + friend QUICK_RANGE_SELECT *get_quick_select(PARAM*,uint idx, + SEL_ARG *key_tree, + uint mrr_flags, + uint mrr_buf_size, + MEM_ROOT *alloc); + friend class QUICK_SELECT_DESC; + friend class QUICK_INDEX_MERGE_SELECT; + friend class QUICK_ROR_INTERSECT_SELECT; + friend class QUICK_GROUP_MIN_MAX_SELECT; + friend uint quick_range_seq_next(range_seq_t rseq, KEY_MULTI_RANGE *range); + friend range_seq_t quick_range_seq_init(void *init_param, + uint n_ranges, uint flags); }; @@ -359,8 +390,10 @@ class QUICK_RANGE_SELECT_GEOM: public QUICK_RANGE_SELECT { public: QUICK_RANGE_SELECT_GEOM(THD *thd, TABLE *table, uint index_arg, - bool no_alloc, MEM_ROOT *parent_alloc) - :QUICK_RANGE_SELECT(thd, table, index_arg, no_alloc, parent_alloc) + bool no_alloc, MEM_ROOT *parent_alloc, + bool *create_err) + :QUICK_RANGE_SELECT(thd, table, index_arg, no_alloc, parent_alloc, + create_err) {}; virtual int get_next(); }; @@ -432,6 +465,7 @@ public: ~QUICK_INDEX_MERGE_SELECT(); int init(); + void need_sorted_output() { DBUG_ASSERT(0); /* Can't do it */ } int reset(void); int get_next(); bool reverse_sorted() { return false; } @@ -491,6 +525,7 @@ public: ~QUICK_ROR_INTERSECT_SELECT(); int init(); + void need_sorted_output() { DBUG_ASSERT(0); /* Can't do it */ } int reset(void); int get_next(); bool reverse_sorted() { return false; } @@ -545,6 +580,7 @@ public: ~QUICK_ROR_UNION_SELECT(); int init(); + void need_sorted_output() { DBUG_ASSERT(0); /* Can't do it */ } int reset(void); int get_next(); bool reverse_sorted() { return false; } @@ -664,6 +700,7 @@ public: void adjust_prefix_ranges(); bool alloc_buffers(); int init(); + void need_sorted_output() { /* always do it */ } int reset(); int get_next(); bool reverse_sorted() { return false; } @@ -679,7 +716,8 @@ public: class QUICK_SELECT_DESC: public QUICK_RANGE_SELECT { public: - QUICK_SELECT_DESC(QUICK_RANGE_SELECT *q, uint used_key_parts); + QUICK_SELECT_DESC(QUICK_RANGE_SELECT *q, uint used_key_parts, + bool *create_err); int get_next(); bool reverse_sorted() { return 1; } int get_type() { return QS_TYPE_RANGE_DESC; } @@ -712,25 +750,29 @@ class SQL_SELECT :public Sql_alloc { { key_map tmp; tmp.set_all(); - return test_quick_select(thd, tmp, 0, limit, force_quick_range) < 0; + return test_quick_select(thd, tmp, 0, limit, force_quick_range, FALSE) < 0; } inline bool skip_record() { return cond ? cond->val_int() == 0 : 0; } int test_quick_select(THD *thd, key_map keys, table_map prev_tables, - ha_rows limit, bool force_quick_range); + ha_rows limit, bool force_quick_range, + bool ordered_output); }; -class FT_SELECT: public QUICK_RANGE_SELECT { +class FT_SELECT: public QUICK_RANGE_SELECT +{ public: - FT_SELECT(THD *thd, TABLE *table, uint key) : - QUICK_RANGE_SELECT (thd, table, key, 1) { VOID(init()); } + FT_SELECT(THD *thd, TABLE *table, uint key, bool *create_err) : + QUICK_RANGE_SELECT (thd, table, key, 1, NULL, create_err) + { (void) init(); } ~FT_SELECT() { file->ft_end(); } - int init() { return error=file->ft_init(); } + int init() { return file->ft_init(); } int reset() { return 0; } - int get_next() { return error= file->ha_ft_read(record); } + int get_next() { return file->ha_ft_read(record); } int get_type() { return QS_TYPE_FULLTEXT; } }; +FT_SELECT *get_ft_select(THD *thd, TABLE *table, uint key); QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, struct st_table_ref *ref, ha_rows records); diff --git a/sql/set_var.cc b/sql/set_var.cc index 7eec4c3e41b..dde8a2c6002 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -439,8 +439,6 @@ static sys_var_long_ptr sys_max_write_lock_count(&vars, "max_write_lock_count", &max_write_lock_count); static sys_var_thd_ulong sys_min_examined_row_limit(&vars, "min_examined_row_limit", &SV::min_examined_row_limit); -static sys_var_thd_ulong sys_multi_range_count(&vars, "multi_range_count", - &SV::multi_range_count); static sys_var_long_ptr sys_myisam_data_pointer_size(&vars, "myisam_data_pointer_size", &myisam_data_pointer_size); static sys_var_thd_ulonglong sys_myisam_max_sort_file_size(&vars, "myisam_max_sort_file_size", &SV::myisam_max_sort_file_size, fix_myisam_max_sort_file_size, 1); @@ -493,6 +491,18 @@ static sys_var_thd_ulong sys_optimizer_search_depth(&vars, "optimizer_sea &SV::optimizer_search_depth); static sys_var_thd_optimizer_switch sys_optimizer_switch(&vars, "optimizer_switch", &SV::optimizer_switch); + +const char *optimizer_use_mrr_names[] = {"auto", "force", "disable", NullS}; +TYPELIB optimizer_use_mrr_typelib= { + array_elements(optimizer_use_mrr_names) - 1, "", + optimizer_use_mrr_names, NULL +}; + +static sys_var_thd_enum sys_optimizer_use_mrr(&vars, "optimizer_use_mrr", + &SV::optimizer_use_mrr, + &optimizer_use_mrr_typelib, + NULL); + static sys_var_const sys_pid_file(&vars, "pid_file", OPT_GLOBAL, SHOW_CHAR, (uchar*) pidfile_name); diff --git a/sql/sql_class.h b/sql/sql_class.h index 72fd927cc1e..4a71b6776e3 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -313,7 +313,6 @@ struct system_variables ulong max_tmp_tables; ulong max_insert_delayed_threads; ulong min_examined_row_limit; - ulong multi_range_count; ulong myisam_repair_threads; ulong myisam_sort_buff_size; ulong myisam_stats_method; @@ -327,6 +326,14 @@ struct system_variables ulong optimizer_search_depth; /* A bitmap for switching optimizations on/off */ ulong optimizer_switch; + /* + Controls use of Engine-MRR: + 0 - auto, based on cost + 1 - force MRR when the storage engine is capable of doing it + 2 - disable MRR. + */ + ulong optimizer_use_mrr; + ulong preload_buff_size; ulong profiling_history_size; ulong query_cache_type; @@ -430,6 +437,13 @@ typedef struct system_status_var ulong ha_read_prev_count; ulong ha_read_rnd_count; ulong ha_read_rnd_next_count; + /* + This number doesn't include calls to the default implementation and + calls made by range access. The intent is to count only calls made by + BatchedKeyAccess. + */ + ulong ha_multi_range_read_init_count; + ulong ha_rollback_count; ulong ha_update_count; ulong ha_write_count; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index f903c193270..434afe8fd69 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -178,11 +178,14 @@ int join_read_always_key_or_null(JOIN_TAB *tab); int join_read_next_same_or_null(READ_RECORD *info); static COND *make_cond_for_table(COND *cond,table_map table, table_map used_table); +static COND *make_cond_for_table_from_pred(COND *root_cond, COND *cond, + table_map tables, + table_map used_table); static Item* part_of_refkey(TABLE *form,Field *field); uint find_shortest_key(TABLE *table, const key_map *usable_keys); static bool test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order, ha_rows select_limit, bool no_changes, - key_map *map); + const key_map *map); static bool list_contains_unique_index(TABLE *table, bool (*find_func) (Field *, void *), void *data); static bool find_field_in_item_list (Field *field, void *data); @@ -237,8 +240,8 @@ static void select_describe(JOIN *join, bool need_tmp_table,bool need_order, bool distinct, const char *message=NullS); static Item *remove_additional_cond(Item* conds); static void add_group_and_distinct_keys(JOIN *join, JOIN_TAB *join_tab); -static bool test_if_ref(Item_field *left_item,Item *right_item); - +static bool test_if_ref(COND *root_cond, + Item_field *left_item,Item *right_item); /** This handles SELECT with and without UNION. @@ -711,7 +714,8 @@ void JOIN::remove_subq_pushed_predicates(Item **where) ((Item_func *)this->conds)->functype() == Item_func::EQ_FUNC && ((Item_func *)conds)->arguments()[0]->type() == Item::REF_ITEM && ((Item_func *)conds)->arguments()[1]->type() == Item::FIELD_ITEM && - test_if_ref ((Item_field *)((Item_func *)conds)->arguments()[1], + test_if_ref (this->conds, + (Item_field *)((Item_func *)conds)->arguments()[1], ((Item_func *)conds)->arguments()[0])) { *where= 0; @@ -2119,7 +2123,7 @@ JOIN::exec() */ curr_table->select->cond->quick_fix_field(); } - curr_table->select_cond= curr_table->select->cond; + curr_table->set_select_cond(curr_table->select->cond, __LINE__); curr_table->select_cond->top_level_item(); DBUG_EXECUTE("where",print_where(curr_table->select->cond, "select and having", @@ -2471,7 +2475,7 @@ static ha_rows get_quick_record_count(THD *thd, SQL_SELECT *select, select->head=table; table->reginfo.impossible_range=0; if ((error= select->test_quick_select(thd, *(key_map *)keys,(table_map) 0, - limit, 0)) == 1) + limit, 0, FALSE)) == 1) DBUG_RETURN(select->quick->records); if (error == -1) { @@ -5678,6 +5682,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse, j->ref.key_buff2=j->ref.key_buff+ALIGN_SIZE(length); j->ref.key_err=1; j->ref.null_rejecting= 0; + j->ref.disable_cache= FALSE; keyuse=org_keyuse; store_key **ref_key= j->ref.key_copy; @@ -5871,6 +5876,7 @@ JOIN::make_simple_join(JOIN *parent, TABLE *tmp_table) join_tab->cache.buff=0; /* No caching */ join_tab->table=tmp_table; join_tab->select=0; + join_tab->set_select_cond(NULL, __LINE__); join_tab->select_cond=0; join_tab->quick=0; join_tab->type= JT_ALL; /* Map through all records */ @@ -5901,6 +5907,7 @@ inline void add_cond_and_fix(Item **e1, Item *e2) { *e1= res; res->quick_fix_field(); + res->update_used_tables(); } } else @@ -5998,7 +6005,9 @@ static void add_not_null_conds(JOIN *join) DBUG_EXECUTE("where",print_where(notnull, referred_tab->table->alias, QT_ORDINARY);); - add_cond_and_fix(&referred_tab->select_cond, notnull); + COND *new_cond= referred_tab->select_cond; + add_cond_and_fix(&new_cond, notnull); + referred_tab->set_select_cond(new_cond, __LINE__); } } } @@ -6171,9 +6180,9 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) if (!tmp) DBUG_RETURN(1); tmp->quick_fix_field(); - cond_tab->select_cond= !cond_tab->select_cond ? tmp : - new Item_cond_and(cond_tab->select_cond, - tmp); + COND *new_cond= !cond_tab->select_cond ? tmp : + new Item_cond_and(cond_tab->select_cond, tmp); + cond_tab->set_select_cond(new_cond, __LINE__); if (!cond_tab->select_cond) DBUG_RETURN(1); cond_tab->select_cond->quick_fix_field(); @@ -6254,7 +6263,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) } } - if (tmp || !cond || tab->type == JT_REF) + if (tmp || !cond || tab->type == JT_REF || tab->type == JT_REF_OR_NULL || + tab->type == JT_EQ_REF || first_inner_tab) { DBUG_EXECUTE("where",print_where(tmp,tab->table->alias, QT_ORDINARY);); SQL_SELECT *sel= tab->select= ((SQL_SELECT*) @@ -6276,11 +6286,12 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) */ if (!(tmp= add_found_match_trig_cond(first_inner_tab, tmp, 0))) DBUG_RETURN(1); - tab->select_cond=sel->cond=tmp; + sel->cond=tmp; + tab->set_select_cond(tmp, __LINE__); /* Push condition to storage engine if this is enabled and the condition is not guarded */ tab->table->file->pushed_cond= NULL; - if (thd->variables.engine_condition_pushdown) + if (thd->variables.engine_condition_pushdown && !first_inner_tab) { COND *push_cond= make_cond_for_table(tmp, current_map, current_map); @@ -6293,7 +6304,11 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) } } else - tab->select_cond= sel->cond= NULL; + { + sel->cond= NULL; + tab->set_select_cond(NULL, __LINE__); + } + sel->head=tab->table; DBUG_EXECUTE("where",print_where(tmp,tab->table->alias, QT_ORDINARY);); @@ -6360,7 +6375,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) (join->select_options & OPTION_FOUND_ROWS ? HA_POS_ERROR : - join->unit->select_limit_cnt), 0) < 0) + join->unit->select_limit_cnt), 0, + FALSE) < 0) { /* Before reporting "Impossible WHERE" for the whole query @@ -6373,7 +6389,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) (join->select_options & OPTION_FOUND_ROWS ? HA_POS_ERROR : - join->unit->select_limit_cnt),0) < 0) + join->unit->select_limit_cnt),0, + FALSE) < 0) DBUG_RETURN(1); // Impossible WHERE } else @@ -6502,6 +6519,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) if (!cond_tab->select_cond) DBUG_RETURN(1); cond_tab->select_cond->quick_fix_field(); + if (cond_tab->select) + cond_tab->select->cond= cond_tab->select_cond; } } first_inner_tab= first_inner_tab->first_upper; @@ -6560,6 +6579,8 @@ make_join_readinfo(JOIN *join, ulonglong options) table->key_read=1; table->file->extra(HA_EXTRA_KEYREAD); } + else + push_index_cond(tab, tab->ref.key, TRUE); break; case JT_EQ_REF: table->status=STATUS_NO_RECORD; @@ -6578,6 +6599,8 @@ make_join_readinfo(JOIN *join, ulonglong options) table->key_read=1; table->file->extra(HA_EXTRA_KEYREAD); } + else + push_index_cond(tab, tab->ref.key, TRUE); break; case JT_REF_OR_NULL: case JT_REF: @@ -6589,12 +6612,6 @@ make_join_readinfo(JOIN *join, ulonglong options) } delete tab->quick; tab->quick=0; - if (table->covering_keys.is_set(tab->ref.key) && - !table->no_keyread) - { - table->key_read=1; - table->file->extra(HA_EXTRA_KEYREAD); - } if (tab->type == JT_REF) { tab->read_first_record= join_read_always_key; @@ -6605,6 +6622,14 @@ make_join_readinfo(JOIN *join, ulonglong options) tab->read_first_record= join_read_always_key_or_null; tab->read_record.read_record= join_read_next_same_or_null; } + if (table->covering_keys.is_set(tab->ref.key) && + !table->no_keyread) + { + table->key_read=1; + table->file->extra(HA_EXTRA_KEYREAD); + } + else + push_index_cond(tab, tab->ref.key, TRUE); break; case JT_FT: table->status=STATUS_NO_RECORD; @@ -6700,6 +6725,9 @@ make_join_readinfo(JOIN *join, ulonglong options) tab->type=JT_NEXT; // Read with index_first / index_next } } + if (tab->select && tab->select->quick && + tab->select->quick->index != MAX_KEY && ! tab->table->key_read) + push_index_cond(tab, tab->select->quick->index, FALSE); } break; default: @@ -12098,7 +12126,8 @@ test_if_quick_select(JOIN_TAB *tab) delete tab->select->quick; tab->select->quick=0; return tab->select->test_quick_select(tab->join->thd, tab->keys, - (table_map) 0, HA_POS_ERROR, 0); + (table_map) 0, HA_POS_ERROR, 0, + FALSE); } @@ -12754,12 +12783,24 @@ end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), 1 if right_item is used removable reference key on left_item */ -static bool test_if_ref(Item_field *left_item,Item *right_item) +static bool test_if_ref(Item *root_cond, Item_field *left_item,Item *right_item) { Field *field=left_item->field; - // No need to change const test. We also have to keep tests on LEFT JOIN - if (!field->table->const_table && !field->table->maybe_null) + JOIN_TAB *join_tab= field->table->reginfo.join_tab; + // No need to change const test + if (!field->table->const_table && join_tab && + (!join_tab->first_inner || + *join_tab->first_inner->on_expr_ref == root_cond)) { + // Cond guards + for (uint i = 0; i < join_tab->ref.key_parts; i++) + { + if (join_tab->ref.cond_guards[i]) + { + return FALSE; + } + } + // Item *ref_item=part_of_refkey(field->table,field); if (ref_item && ref_item->eq(right_item,1)) { @@ -12790,9 +12831,49 @@ static bool test_if_ref(Item_field *left_item,Item *right_item) } +/* + Extract a condition that can be checked after reading given table + + SYNOPSIS + make_cond_for_table() + cond Condition to analyze + tables Tables for which "current field values" are available + used_table Table that we're extracting the condition for (may + also include PSEUDO_TABLE_BITS + exclude_expensive_cond Do not push expensive conditions + + DESCRIPTION + Extract the condition that can be checked after reading the table + specified in 'used_table', given that current-field values for tables + specified in 'tables' bitmap are available. + + The function assumes that + - Constant parts of the condition has already been checked. + - Condition that could be checked for tables in 'tables' has already + been checked. + + The function takes into account that some parts of the condition are + guaranteed to be true by employed 'ref' access methods (the code that + does this is located at the end, search down for "EQ_FUNC"). + + + SEE ALSO + make_cond_for_info_schema uses similar algorithm + + RETURN + Extracted condition +*/ + static COND * make_cond_for_table(COND *cond, table_map tables, table_map used_table) { + return make_cond_for_table_from_pred(cond, cond, tables, used_table); +} + +static COND * +make_cond_for_table_from_pred(COND *root_cond, COND *cond, + table_map tables, table_map used_table) +{ if (used_table && !(cond->used_tables() & used_table)) return (COND*) 0; // Already checked if (cond->type() == Item::COND_ITEM) @@ -12807,7 +12888,7 @@ make_cond_for_table(COND *cond, table_map tables, table_map used_table) Item *item; while ((item=li++)) { - Item *fix=make_cond_for_table(item,tables,used_table); + Item *fix=make_cond_for_table_from_pred(root_cond, item, tables, used_table); if (fix) new_cond->argument_list()->push_back(fix); } @@ -12837,7 +12918,7 @@ make_cond_for_table(COND *cond, table_map tables, table_map used_table) Item *item; while ((item=li++)) { - Item *fix=make_cond_for_table(item,tables,0L); + Item *fix=make_cond_for_table_from_pred(root_cond, item, tables, 0L); if (!fix) return (COND*) 0; // Always true new_cond->argument_list()->push_back(fix); @@ -12864,18 +12945,19 @@ make_cond_for_table(COND *cond, table_map tables, table_map used_table) if (cond->marker == 2 || cond->eq_cmp_result() == Item::COND_OK) return cond; // Not boolean op - if (((Item_func*) cond)->functype() == Item_func::EQ_FUNC) + if (cond->type() == Item::FUNC_ITEM && + ((Item_func*) cond)->functype() == Item_func::EQ_FUNC) { - Item *left_item= ((Item_func*) cond)->arguments()[0]; - Item *right_item= ((Item_func*) cond)->arguments()[1]; + Item *left_item= ((Item_func*) cond)->arguments()[0]->real_item(); + Item *right_item= ((Item_func*) cond)->arguments()[1]->real_item(); if (left_item->type() == Item::FIELD_ITEM && - test_if_ref((Item_field*) left_item,right_item)) + test_if_ref(root_cond, (Item_field*) left_item,right_item)) { cond->marker=3; // Checked when read return (COND*) 0; } if (right_item->type() == Item::FIELD_ITEM && - test_if_ref((Item_field*) right_item,left_item)) + test_if_ref(root_cond, (Item_field*) right_item,left_item)) { cond->marker=3; // Checked when read return (COND*) 0; @@ -13259,7 +13341,7 @@ find_field_in_item_list (Field *field, void *data) static bool test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, - bool no_changes, key_map *map) + bool no_changes, const key_map *map) { int ref_key; uint ref_key_parts; @@ -13269,6 +13351,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, SQL_SELECT *select=tab->select; key_map usable_keys; QUICK_SELECT_I *save_quick= 0; + COND *orig_select_cond= 0; DBUG_ENTER("test_if_skip_sort_order"); LINT_INIT(ref_key_parts); @@ -13288,7 +13371,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, } usable_keys.intersect(((Item_field*) item)->field->part_of_sortkey); if (usable_keys.is_clear_all()) - DBUG_RETURN(0); // No usable keys + goto use_filesort; // No usable keys } ref_key= -1; @@ -13298,7 +13381,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, ref_key= tab->ref.key; ref_key_parts= tab->ref.key_parts; if (tab->type == JT_REF_OR_NULL || tab->type == JT_FT) - DBUG_RETURN(0); + goto use_filesort; } else if (select && select->quick) // Range found by opt_range { @@ -13313,7 +13396,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, if (quick_type == QUICK_SELECT_I::QS_TYPE_INDEX_MERGE || quick_type == QUICK_SELECT_I::QS_TYPE_ROR_UNION || quick_type == QUICK_SELECT_I::QS_TYPE_ROR_INTERSECT) - DBUG_RETURN(0); + goto use_filesort; ref_key= select->quick->index; ref_key_parts= select->quick->used_key_parts; } @@ -13335,10 +13418,15 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, */ if (table->covering_keys.is_set(ref_key)) usable_keys.intersect(table->covering_keys); + if (tab->pre_idx_push_select_cond) + orig_select_cond= tab->set_cond(tab->pre_idx_push_select_cond); + if ((new_ref_key= test_if_subkey(order, table, ref_key, ref_key_parts, &usable_keys)) < MAX_KEY) { /* Found key that can be used to retrieve data in sorted order */ + //psergey-mrr:if (tab->pre_idx_push_select_cond) + // tab->select_cond= tab->select->cond= tab->pre_idx_push_select_cond; if (tab->ref.key >= 0) { /* @@ -13352,9 +13440,10 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, KEYUSE *keyuse= tab->keyuse; while (keyuse->key != new_ref_key && keyuse->table == tab->table) keyuse++; + if (create_ref_for_key(tab->join, tab, keyuse, tab->join->const_table_map)) - DBUG_RETURN(0); + goto use_filesort; } else { @@ -13374,9 +13463,10 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, (tab->join->select_options & OPTION_FOUND_ROWS) ? HA_POS_ERROR : - tab->join->unit->select_limit_cnt,0) <= + tab->join->unit->select_limit_cnt,0, + TRUE) <= 0) - DBUG_RETURN(0); + goto use_filesort; } ref_key= new_ref_key; } @@ -13424,7 +13514,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, index order and not using join cache */ if (tab->type == JT_ALL && tab->join->tables > tab->join->const_tables + 1) - DBUG_RETURN(0); + goto use_filesort; keys= *table->file->keys_to_use_for_scanning(); keys.merge(table->covering_keys); @@ -13580,7 +13670,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, join->select_options & OPTION_FOUND_ROWS ? HA_POS_ERROR : join->unit->select_limit_cnt, - 0) > 0; + TRUE, FALSE) > 0; } if (!no_changes) { @@ -13609,6 +13699,18 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, table->key_read=1; table->file->extra(HA_EXTRA_KEYREAD); } + if (tab->pre_idx_push_select_cond) + { + COND *tmp_cond= tab->pre_idx_push_select_cond; + if (orig_select_cond) + { + tmp_cond= and_conds(tmp_cond, orig_select_cond); + tmp_cond->quick_fix_field(); + } + tab->set_cond(tmp_cond); + /* orig_select_cond was merged, no need to restore original one. */ + orig_select_cond= 0; + } table->file->ha_index_or_rnd_end(); if (join->select_options & SELECT_DESCRIBE) { @@ -13642,7 +13744,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, order_direction= best_key_direction; } else - DBUG_RETURN(0); + goto use_filesort; } check_reverse_order: @@ -13657,6 +13759,7 @@ check_reverse_order: if (!select->quick->reverse_sorted()) { QUICK_SELECT_DESC *tmp; + bool error= FALSE; int quick_type= select->quick->get_type(); if (quick_type == QUICK_SELECT_I::QS_TYPE_INDEX_MERGE || quick_type == QUICK_SELECT_I::QS_TYPE_ROR_INTERSECT || @@ -13665,18 +13768,18 @@ check_reverse_order: { tab->limit= 0; select->quick= save_quick; - DBUG_RETURN(0); // Use filesort + goto use_filesort; // Use filesort } /* ORDER BY range_key DESC */ tmp= new QUICK_SELECT_DESC((QUICK_RANGE_SELECT*)(select->quick), - used_key_parts); - if (!tmp || tmp->error) + used_key_parts, &error); + if (!tmp || error) { delete tmp; select->quick= save_quick; tab->limit= 0; - DBUG_RETURN(0); // Reverse sort not supported + goto use_filesort; // Reverse sort not supported } select->quick=tmp; } @@ -13695,8 +13798,14 @@ check_reverse_order: } } else if (select && select->quick) - select->quick->sorted= 1; + select->quick->need_sorted_output(); + if (orig_select_cond) + tab->set_cond(orig_select_cond); DBUG_RETURN(1); +use_filesort: + if (orig_select_cond) + tab->set_cond(orig_select_cond); + DBUG_RETURN(0); } @@ -13797,7 +13906,7 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order, field, quick will contain an empty record set. */ if (!(select->quick= (tab->type == JT_FT ? - new FT_SELECT(thd, table, tab->ref.key) : + get_ft_select(thd, table, tab->ref.key) : get_quick_select_for_ref(thd, table, &tab->ref, tab->found_records)))) goto err; @@ -13836,7 +13945,7 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order, table->quick_keys.clear_all(); // as far as we cleanup select->quick table->sort.io_cache= tablesort_result_cache; } - tab->select_cond=0; + tab->set_select_cond(NULL, __LINE__); tab->last_inner= 0; tab->first_unmatched= 0; tab->type=JT_ALL; // Read with normal read_record @@ -13877,7 +13986,7 @@ static bool fix_having(JOIN *join, Item **having) sort_table_cond)) || table->select->cond->fix_fields(join->thd, &table->select->cond)) return 1; - table->select_cond=table->select->cond; + table->set_select_cond(table->select->cond, __LINE__); table->select_cond->top_level_item(); DBUG_EXECUTE("where",print_where(table->select_cond, "select and having", @@ -14468,19 +14577,50 @@ read_cached_record(JOIN_TAB *tab) } +/* + eq_ref: Create the lookup key and check if it is the same as saved key + + SYNOPSIS + cmp_buffer_with_ref() + tab Join tab of the accessed table + table The table to read. This is usually tab->table, except for + semi-join when we might need to make a lookup in a temptable + instead. + tab_ref The structure with methods to collect index lookup tuple. + This is usually table->ref, except for the case of when we're + doing lookup into semi-join materialization table. + + DESCRIPTION + Used by eq_ref access method: create the index lookup key and check if + we've used this key at previous lookup (If yes, we don't need to repeat + the lookup - the record has been already fetched) + + RETURN + TRUE No cached record for the key, or failed to create the key (due to + out-of-domain error) + FALSE The created key is the same as the previous one (and the record + is already in table->record) +*/ + static bool cmp_buffer_with_ref(JOIN_TAB *tab) { - bool diff; - if (!(diff=tab->ref.key_err)) + TABLE_REF *tab_ref= &tab->ref; + bool no_prev_key; + if (!tab_ref->disable_cache) { - memcpy(tab->ref.key_buff2, tab->ref.key_buff, tab->ref.key_length); + if (!(no_prev_key= tab_ref->key_err)) + { + /* Previous access found a row. Copy its key */ + memcpy(tab_ref->key_buff2, tab_ref->key_buff, tab_ref->key_length); + } } - if ((tab->ref.key_err= cp_buffer_from_ref(tab->join->thd, tab->table, - &tab->ref)) || - diff) + else + no_prev_key= TRUE; + if ((tab_ref->key_err= cp_buffer_from_ref(tab->join->thd, tab->table, tab_ref)) || + no_prev_key) return 1; - return memcmp(tab->ref.key_buff2, tab->ref.key_buff, tab->ref.key_length) + return memcmp(tab_ref->key_buff2, tab_ref->key_buff, tab_ref->key_length) != 0; } @@ -15764,11 +15904,12 @@ static bool add_ref_to_table_cond(THD *thd, JOIN_TAB *join_tab) if (join_tab->select) { error=(int) cond->add(join_tab->select->cond); - join_tab->select_cond=join_tab->select->cond=cond; + join_tab->select->cond= cond; + join_tab->set_select_cond(cond, __LINE__); } else if ((join_tab->select= make_select(join_tab->table, 0, 0, cond, 0, &error))) - join_tab->select_cond=cond; + join_tab->set_select_cond(cond, __LINE__); DBUG_RETURN(error ? TRUE : FALSE); } @@ -16584,6 +16725,20 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, } else { + uint keyno= MAX_KEY; + if (tab->ref.key_parts) + keyno= tab->ref.key; + else if (tab->select && tab->select->quick) + keyno = tab->select->quick->index; + + if (keyno != MAX_KEY && keyno == table->file->pushed_idx_cond_keyno && + table->file->pushed_idx_cond) + extra.append(STRING_WITH_LEN("; Using index condition")); + /** + psergey-mrr: + else if (tab->cache_idx_cond) + extra.append(STRING_WITH_LEN("; Using index condition(BKA)")); + **/ if (quick_type == QUICK_SELECT_I::QS_TYPE_ROR_UNION || quick_type == QUICK_SELECT_I::QS_TYPE_ROR_INTERSECT || quick_type == QUICK_SELECT_I::QS_TYPE_INDEX_MERGE) @@ -16647,6 +16802,14 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, } if (table->reginfo.not_exists_optimize) extra.append(STRING_WITH_LEN("; Not exists")); + + if (quick_type == QUICK_SELECT_I::QS_TYPE_RANGE && + !(((QUICK_RANGE_SELECT*)(tab->select->quick))->mrr_flags & + HA_MRR_USE_DEFAULT_IMPL)) + { + extra.append(STRING_WITH_LEN("; Using MRR")); + } + if (need_tmp_table) { need_tmp_table=0; diff --git a/sql/sql_select.h b/sql/sql_select.h index 271c88ebf66..0a6702a8135 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -85,6 +85,12 @@ typedef struct st_table_ref table_map depend_map; ///< Table depends on these tables. /* null byte position in the key_buf. Used for REF_OR_NULL optimization */ uchar *null_ref_key; + + /* + TRUE <=> disable the "cache" as doing lookup with the same key value may + produce different results (because of Index Condition Pushdown) + */ + bool disable_cache; } TABLE_REF; @@ -145,6 +151,14 @@ typedef struct st_join_table { SQL_SELECT *select; COND *select_cond; QUICK_SELECT_I *quick; + /* + The value of select_cond before we've attempted to do Index Condition + Pushdown. We may need to restore everything back if we first choose one + index but then reconsider (see test_if_skip_sort_order() for such + scenarios). + NULL means no index condition pushdown was performed. + */ + Item *pre_idx_push_select_cond; Item **on_expr_ref; /**< pointer to the associated on expression */ COND_EQUAL *cond_equal; /**< multiple equalities for the on expression */ st_join_table *first_inner; /**< first inner table for including outerjoin */ @@ -218,6 +232,20 @@ typedef struct st_join_table { (select->quick->get_type() == QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX)); } + void set_select_cond(COND *to, uint line) + { + DBUG_PRINT("info", ("select_cond changes %p -> %p at line %u tab %p", + select_cond, to, line, this)); + select_cond= to; + } + COND *set_cond(COND *new_cond) + { + COND *tmp_select_cond= select_cond; + set_select_cond(new_cond, __LINE__); + if (select) + select->cond= new_cond; + return tmp_select_cond; + } } JOIN_TAB; enum_nested_loop_state sub_select_cache(JOIN *join, JOIN_TAB *join_tab, bool @@ -752,3 +780,7 @@ inline bool optimizer_flag(THD *thd, uint flag) void eliminate_tables(JOIN *join); +/// psergey-mrr: +void push_index_cond(JOIN_TAB *tab, uint keyno, bool other_tbls_ok); + + diff --git a/sql/structs.h b/sql/structs.h index 3a090fd203f..9dffe1e1b8c 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -53,7 +53,8 @@ typedef struct st_key_part_info { /* Info about a key part */ Field *field; uint offset; /* offset in record (from 0) */ uint null_offset; /* Offset to null_bit in record */ - uint16 length; /* Length of keypart value in bytes */ + /* Length of key part in bytes, excluding NULL flag and length bytes */ + uint16 length; /* Number of bytes required to store the keypart value. This may be different from the "length" field as it also counts diff --git a/sql/table.cc b/sql/table.cc index 1c10958fdef..c2d58bac982 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1556,21 +1556,11 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, share->table_name.str, share->table_name.str); share->crashed= 1; // Marker for CHECK TABLE - goto to_be_deleted; + continue; } #endif key_part->key_part_flag|= HA_PART_KEY_SEG; } - - to_be_deleted: - - /* - If the field can be NULL, don't optimize away the test - key_part_column = expression from the WHERE clause - as we need to test for NULL = NULL. - */ - if (field->real_maybe_null()) - key_part->key_part_flag|= HA_NULL_PART; } keyinfo->usable_key_parts= usable_parts; // Filesort diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 1b583353126..772989109d0 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -2020,6 +2020,21 @@ int ha_maria::delete_row(const uchar * buf) return maria_delete(file, buf); } +C_MODE_START + +my_bool index_cond_func_maria(void *arg) +{ + ha_maria *h= (ha_maria*)arg; + /*if (h->in_range_read)*/ + if (h->end_range) + { + if (h->compare_key2(h->end_range) > 0) + return 2; /* caller should return HA_ERR_END_OF_FILE already */ + } + return (my_bool)h->pushed_idx_cond->val_int(); +} + +C_MODE_END int ha_maria::index_read_map(uchar * buf, const uchar * key, key_part_map keypart_map, @@ -2117,6 +2132,25 @@ int ha_maria::index_next_same(uchar * buf, } +int ha_maria::index_init(uint idx, bool sorted) +{ + active_index=idx; + if (pushed_idx_cond_keyno == idx) + ma_set_index_cond_func(file, index_cond_func_maria, this); + return 0; +} + + +int ha_maria::index_end() +{ + active_index=MAX_KEY; + ma_set_index_cond_func(file, NULL, 0); + in_range_check_pushed_down= FALSE; + ds_mrr.dsmrr_close(); + return 0; +} + + int ha_maria::rnd_init(bool scan) { if (scan) @@ -2201,6 +2235,7 @@ int ha_maria::info(uint flag, my_bool lock_table_share) ref_length= maria_info.reflength; share->db_options_in_use= maria_info.options; stats.block_size= maria_block_size; + stats.mrr_length_per_rec= maria_info.reflength + 8; // 8 = max(sizeof(void *)) /* Update share */ if (lock_table_share) @@ -2275,6 +2310,10 @@ int ha_maria::extra(enum ha_extra_function operation) int ha_maria::reset(void) { + pushed_idx_cond= NULL; + pushed_idx_cond_keyno= MAX_KEY; + ma_set_index_cond_func(file, NULL, 0); + ds_mrr.dsmrr_close(); return maria_reset(file); } @@ -3333,6 +3372,64 @@ static SHOW_VAR status_variables[]= { {NullS, NullS, SHOW_LONG} }; +/**************************************************************************** + * Maria MRR implementation: use DS-MRR + ***************************************************************************/ + +int ha_maria::multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, + uint n_ranges, uint mode, + HANDLER_BUFFER *buf) +{ + return ds_mrr.dsmrr_init(this, seq, seq_init_param, n_ranges, mode, buf); +} + +int ha_maria::multi_range_read_next(char **range_info) +{ + return ds_mrr.dsmrr_next(range_info); +} + +ha_rows ha_maria::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, uint *bufsz, + uint *flags, COST_VECT *cost) +{ + /* + This call is here because there is no location where this->table would + already be known. + TODO: consider moving it into some per-query initialization call. + */ + ds_mrr.init(this, table); + return ds_mrr.dsmrr_info_const(keyno, seq, seq_init_param, n_ranges, bufsz, + flags, cost); +} + +ha_rows ha_maria::multi_range_read_info(uint keyno, uint n_ranges, uint keys, + uint *bufsz, uint *flags, + COST_VECT *cost) +{ + ds_mrr.init(this, table); + return ds_mrr.dsmrr_info(keyno, n_ranges, keys, bufsz, flags, cost); +} + +/* MyISAM MRR implementation ends */ + + +/* Index condition pushdown implementation*/ + + +Item *ha_maria::idx_cond_push(uint keyno_arg, Item* idx_cond_arg) +{ + pushed_idx_cond_keyno= keyno_arg; + pushed_idx_cond= idx_cond_arg; + in_range_check_pushed_down= TRUE; + if (active_index == pushed_idx_cond_keyno) + ma_set_index_cond_func(file, index_cond_func_maria, this); + return NULL; +} + + + + struct st_mysql_storage_engine maria_storage_engine= { MYSQL_HANDLERTON_INTERFACE_VERSION }; diff --git a/storage/maria/ha_maria.h b/storage/maria/ha_maria.h index 23fb74f1c27..c295527c2dc 100644 --- a/storage/maria/ha_maria.h +++ b/storage/maria/ha_maria.h @@ -28,6 +28,10 @@ #define HA_RECOVER_FORCE 4 /* Recover even if we loose rows */ #define HA_RECOVER_QUICK 8 /* Don't check rows in data file */ +C_MODE_START +my_bool index_cond_func_maria(void *arg); +C_MODE_END + extern ulong maria_sort_buffer_size; extern TYPELIB maria_recover_typelib; extern ulong maria_recover_options; @@ -62,7 +66,7 @@ public: { return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ? 0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE | - HA_READ_ORDER | HA_KEYREAD_ONLY); + HA_READ_ORDER | HA_KEYREAD_ONLY | HA_DO_INDEX_COND_PUSHDOWN); } uint max_supported_keys() const { return MARIA_MAX_KEY; } @@ -104,6 +108,8 @@ public: key->charset(), table->record[0]); } int ft_read(uchar * buf); + int index_init(uint idx, bool sorted); + int index_end(); int rnd_init(bool scan); int rnd_end(void); int rnd_next(uchar * buf); @@ -164,4 +170,22 @@ public: return file; } static int implicit_commit(THD *thd, bool new_trn); + /** + * Multi Range Read interface + */ + int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, + uint n_ranges, uint mode, HANDLER_BUFFER *buf); + int multi_range_read_next(char **range_info); + ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, uint *bufsz, + uint *flags, COST_VECT *cost); + ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys, + uint *bufsz, uint *flags, COST_VECT *cost); + + /* Index condition pushdown implementation */ + Item *idx_cond_push(uint keyno, Item* idx_cond); +private: + DsMrr_impl ds_mrr; + friend my_bool index_cond_func_maria(void *arg); }; diff --git a/storage/maria/ma_extra.c b/storage/maria/ma_extra.c index 691e55b2a2a..4499cca2885 100644 --- a/storage/maria/ma_extra.c +++ b/storage/maria/ma_extra.c @@ -474,6 +474,14 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function, } /* maria_extra */ +void ma_set_index_cond_func(MARIA_HA *info, index_cond_func_t func, + void *func_arg) +{ + info->index_cond_func= func; + info->index_cond_func_arg= func_arg; +} + + /* Start/Stop Inserting Duplicates Into a Table, WL#1648. */ @@ -620,3 +628,4 @@ int _ma_flush_table_files(MARIA_HA *info, uint flush_data_or_index, maria_mark_crashed(info); return 1; } + diff --git a/storage/maria/ma_key.c b/storage/maria/ma_key.c index 08702a9109e..c1067873c0e 100644 --- a/storage/maria/ma_key.c +++ b/storage/maria/ma_key.c @@ -26,7 +26,8 @@ #define CHECK_KEYS /* Enable safety checks */ -static int _ma_put_key_in_record(MARIA_HA *info,uint keynr,uchar *record); +static int _ma_put_key_in_record(MARIA_HA *info, uint keynr, + my_bool unpack_blobs, uchar *record); #define FIX_LENGTH(cs, pos, length, char_length) \ do { \ @@ -476,6 +477,9 @@ void _ma_copy_key(MARIA_KEY *to, const MARIA_KEY *from) _ma_put_key_in_record() info MARIA handler keynr Key number that was used + unpack_blobs TRUE <=> Unpack blob columns + FALSE <=> Skip them. This is used by index condition + pushdown check function record Store key here Last read key is in info->lastkey @@ -489,7 +493,7 @@ void _ma_copy_key(MARIA_KEY *to, const MARIA_KEY *from) */ static int _ma_put_key_in_record(register MARIA_HA *info, uint keynr, - uchar *record) + my_bool unpack_blobs, uchar *record) { reg2 uchar *key; uchar *pos,*key_end; @@ -582,16 +586,19 @@ static int _ma_put_key_in_record(register MARIA_HA *info, uint keynr, if (length > keyseg->length || key+length > key_end) goto err; #endif - memcpy(record+keyseg->start+keyseg->bit_start, - (char*) &blob_ptr,sizeof(char*)); - memcpy(blob_ptr,key,length); - blob_ptr+=length; + if (unpack_blobs) + { + memcpy(record+keyseg->start+keyseg->bit_start, + (char*) &blob_ptr,sizeof(char*)); + memcpy(blob_ptr,key,length); + blob_ptr+=length; - /* The above changed info->lastkey2. Inform maria_rnext_same(). */ - info->update&= ~HA_STATE_RNEXT_SAME; + /* The above changed info->lastkey2. Inform maria_rnext_same(). */ + info->update&= ~HA_STATE_RNEXT_SAME; - _ma_store_blob_length(record+keyseg->start, - (uint) keyseg->bit_start,length); + _ma_store_blob_length(record+keyseg->start, + (uint) keyseg->bit_start,length); + } key+=length; } else if (keyseg->flag & HA_SWAP_KEY) @@ -621,6 +628,7 @@ static int _ma_put_key_in_record(register MARIA_HA *info, uint keynr, DBUG_RETURN(0); err: + DBUG_PRINT("info",("error")); DBUG_RETURN(1); /* Crashed row */ } /* _ma_put_key_in_record */ @@ -634,7 +642,7 @@ int _ma_read_key_record(MARIA_HA *info, uchar *buf, MARIA_RECORD_POS filepos) { if (info->lastinx >= 0) { /* Read only key */ - if (_ma_put_key_in_record(info,(uint) info->lastinx,buf)) + if (_ma_put_key_in_record(info, (uint)info->lastinx, TRUE, buf)) { maria_print_error(info->s, HA_ERR_CRASHED); my_errno=HA_ERR_CRASHED; @@ -649,6 +657,40 @@ int _ma_read_key_record(MARIA_HA *info, uchar *buf, MARIA_RECORD_POS filepos) } + +/* + Save current key tuple to record and call index condition check function + + SYNOPSIS + ma_check_index_cond() + info MyISAM handler + keynr Index we're running a scan on + record Record buffer to use (it is assumed that index check function + will look for column values there) + + RETURN + -1 Error + 0 Index condition is not satisfied, continue scanning + 1 Index condition is satisfied + 2 Index condition is not satisfied, end the scan. +*/ + +int ma_check_index_cond(register MARIA_HA *info, uint keynr, uchar *record) +{ + if (info->index_cond_func) + { + if (_ma_put_key_in_record(info, keynr, FALSE, record)) + { + maria_print_error(info->s, HA_ERR_CRASHED); + my_errno=HA_ERR_CRASHED; + return -1; + } + return info->index_cond_func(info->index_cond_func_arg); + } + return 1; +} + + /* Retrieve auto_increment info diff --git a/storage/maria/ma_rkey.c b/storage/maria/ma_rkey.c index 9e529aca666..32a0e141b1d 100644 --- a/storage/maria/ma_rkey.c +++ b/storage/maria/ma_rkey.c @@ -34,6 +34,7 @@ int maria_rkey(MARIA_HA *info, uchar *buf, int inx, const uchar *key_data, HA_KEYSEG *last_used_keyseg; uint32 nextflag; MARIA_KEY key; + int icp_res= 1; DBUG_ENTER("maria_rkey"); DBUG_PRINT("enter", ("base: 0x%lx buf: 0x%lx inx: %d search_flag: %d", (long) info, (long) buf, inx, search_flag)); @@ -106,9 +107,13 @@ int maria_rkey(MARIA_HA *info, uchar *buf, int inx, const uchar *key_data, are inserted by other threads after we got our table lock ("concurrent inserts"). The record may not even be present yet. Keys are inserted into the index(es) before the record is - inserted into the data file. + inserted into the data file. + + If index condition is present, it must be either satisfied or + not satisfied with an out-of-range condition. */ - if ((*share->row_is_visible)(info)) + if ((*share->row_is_visible)(info) && + ((icp_res= ma_check_index_cond(info, inx, buf)) != 0)) break; /* The key references a concurrently inserted record. */ @@ -120,7 +125,7 @@ int maria_rkey(MARIA_HA *info, uchar *buf, int inx, const uchar *key_data, info->cur_row.lastpos= HA_OFFSET_ERROR; break; } - + do { uint not_used[2]; @@ -151,18 +156,25 @@ int maria_rkey(MARIA_HA *info, uchar *buf, int inx, const uchar *key_data, break; /* purecov: end */ } - } while (!(*share->row_is_visible)(info)); + + } while (!(*share->row_is_visible)(info) || + ((icp_res= ma_check_index_cond(info, inx, buf)) == 0)); } } if (share->lock_key_trees) rw_unlock(&keyinfo->root_lock); - if (info->cur_row.lastpos == HA_OFFSET_ERROR) + if (info->cur_row.lastpos == HA_OFFSET_ERROR || (icp_res != 1)) { + if (icp_res == 2) + { + info->cur_row.lastpos= HA_OFFSET_ERROR; + my_errno= HA_ERR_KEY_NOT_FOUND; + } fast_ma_writeinfo(info); goto err; } - + /* Calculate length of the found key; Used by maria_rnext_same */ if ((keyinfo->flag & HA_VAR_LENGTH_KEY)) info->last_rkey_length= _ma_keylength_part(keyinfo, info->lastkey_buff, diff --git a/storage/maria/ma_rnext.c b/storage/maria/ma_rnext.c index be960eccfe0..bdba5ff3a17 100644 --- a/storage/maria/ma_rnext.c +++ b/storage/maria/ma_rnext.c @@ -30,6 +30,7 @@ int maria_rnext(MARIA_HA *info, uchar *buf, int inx) uint flag; MARIA_SHARE *share= info->s; MARIA_KEYDEF *keyinfo; + int icp_res= 1; DBUG_ENTER("maria_rnext"); if ((inx = _ma_check_index(info,inx)) < 0) @@ -90,7 +91,8 @@ int maria_rnext(MARIA_HA *info, uchar *buf, int inx) if (!error) { - while (!(*share->row_is_visible)(info)) + while (!(*share->row_is_visible)(info) || + ((icp_res= ma_check_index_cond(info, inx, buf)) == 0)) { /* Skip rows inserted by other threads since we got a lock */ if ((error= _ma_search_next(info, &info->last_key, @@ -105,8 +107,11 @@ int maria_rnext(MARIA_HA *info, uchar *buf, int inx) /* Don't clear if database-changed */ info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); info->update|= HA_STATE_NEXT_FOUND; + + if (icp_res == 2) + my_errno=HA_ERR_END_OF_FILE; /* got beyond the end of scanned range */ - if (error) + if (error || icp_res != 1) { if (my_errno == HA_ERR_KEY_NOT_FOUND) my_errno=HA_ERR_END_OF_FILE; diff --git a/storage/maria/ma_rnext_same.c b/storage/maria/ma_rnext_same.c index cbd81d20816..597d97fc78a 100644 --- a/storage/maria/ma_rnext_same.c +++ b/storage/maria/ma_rnext_same.c @@ -30,6 +30,7 @@ int maria_rnext_same(MARIA_HA *info, uchar *buf) int error; uint inx,not_used[2]; MARIA_KEYDEF *keyinfo; + int icp_res= 1; DBUG_ENTER("maria_rnext_same"); if ((int) (inx= info->lastinx) < 0 || @@ -80,7 +81,8 @@ int maria_rnext_same(MARIA_HA *info, uchar *buf) break; } /* Skip rows that are inserted by other threads since we got a lock */ - if ((info->s->row_is_visible)(info)) + if ((info->s->row_is_visible)(info) || + ((icp_res= ma_check_index_cond(info, inx, buf)) != 0)) break; } } @@ -90,7 +92,10 @@ int maria_rnext_same(MARIA_HA *info, uchar *buf) info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); info->update|= HA_STATE_NEXT_FOUND | HA_STATE_RNEXT_SAME; - if (error) + if (icp_res == 2) + my_errno=HA_ERR_END_OF_FILE; /* got beyond the end of scanned range */ + + if (error || icp_res != 1) { if (my_errno == HA_ERR_KEY_NOT_FOUND) my_errno=HA_ERR_END_OF_FILE; diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h index ada4ae3f426..cf36b76eaba 100644 --- a/storage/maria/maria_def.h +++ b/storage/maria/maria_def.h @@ -477,6 +477,8 @@ typedef struct st_maria_block_scan MARIA_RECORD_POS row_base_page; } MARIA_BLOCK_SCAN; +/*psergey-todo: do really need to have copies of this all over the place?*/ +typedef my_bool (*index_cond_func_t)(void *param); struct st_maria_handler { @@ -577,6 +579,9 @@ struct st_maria_handler uchar *maria_rtree_recursion_state; /* For RTREE */ uchar length_buff[5]; /* temp buff to store blob lengths */ int maria_rtree_recursion_depth; + + index_cond_func_t index_cond_func; /* Index condition function */ + void *index_cond_func_arg; /* parameter for the func */ }; /* Some defines used by maria-functions */ @@ -1236,3 +1241,6 @@ extern my_bool maria_flush_log_for_page_none(uchar *page, uchar *data_ptr); void maria_concurrent_inserts(MARIA_HA *info, my_bool concurrent_insert); extern PAGECACHE *maria_log_pagecache; +extern void ma_set_index_cond_func(MARIA_HA *info, index_cond_func_t func, + void *func_arg); +int ma_check_index_cond(register MARIA_HA *info, uint keynr, uchar *record); diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index d92a576a5d7..7e319fc80f6 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -1676,6 +1676,48 @@ int ha_myisam::delete_row(const uchar *buf) return mi_delete(file,buf); } + +C_MODE_START + +ICP_RESULT index_cond_func_myisam(void *arg) +{ + ha_myisam *h= (ha_myisam*)arg; + if (h->end_range) + { + if (h->compare_key2(h->end_range) > 0) + return ICP_OUT_OF_RANGE; /* caller should return HA_ERR_END_OF_FILE already */ + } + return (ICP_RESULT) test(h->pushed_idx_cond->val_int()); +} + +C_MODE_END + + +int ha_myisam::index_init(uint idx, bool sorted) +{ + active_index=idx; + if (pushed_idx_cond_keyno == idx) + mi_set_index_cond_func(file, index_cond_func_myisam, this); + return 0; +} + + +int ha_myisam::index_end() +{ + active_index=MAX_KEY; + //pushed_idx_cond_keyno= MAX_KEY; + mi_set_index_cond_func(file, NULL, 0); + in_range_check_pushed_down= FALSE; + ds_mrr.dsmrr_close(); + return 0; +} + +int ha_myisam::rnd_end() +{ + ds_mrr.dsmrr_close(); + return 0; +} + int ha_myisam::index_read_map(uchar *buf, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) @@ -1878,8 +1920,13 @@ int ha_myisam::extra(enum ha_extra_function operation) return mi_extra(file, operation, 0); } + int ha_myisam::reset(void) { + pushed_idx_cond= NULL; + pushed_idx_cond_keyno= MAX_KEY; + mi_set_index_cond_func(file, NULL, 0); + ds_mrr.dsmrr_close(); return mi_reset(file); } @@ -2164,6 +2211,62 @@ static int myisam_init(void *p) return 0; } +/**************************************************************************** + * MyISAM MRR implementation: use DS-MRR + ***************************************************************************/ + +int ha_myisam::multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, + uint n_ranges, uint mode, + HANDLER_BUFFER *buf) +{ + return ds_mrr.dsmrr_init(this, seq, seq_init_param, n_ranges, mode, buf); +} + +int ha_myisam::multi_range_read_next(char **range_info) +{ + return ds_mrr.dsmrr_next(range_info); +} + +ha_rows ha_myisam::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, uint *bufsz, + uint *flags, COST_VECT *cost) +{ + /* + This call is here because there is no location where this->table would + already be known. + TODO: consider moving it into some per-query initialization call. + */ + ds_mrr.init(this, table); + return ds_mrr.dsmrr_info_const(keyno, seq, seq_init_param, n_ranges, bufsz, + flags, cost); +} + +ha_rows ha_myisam::multi_range_read_info(uint keyno, uint n_ranges, uint keys, + uint *bufsz, uint *flags, + COST_VECT *cost) +{ + ds_mrr.init(this, table); + return ds_mrr.dsmrr_info(keyno, n_ranges, keys, bufsz, flags, cost); +} + +/* MyISAM MRR implementation ends */ + + +/* Index condition pushdown implementation*/ + + +Item *ha_myisam::idx_cond_push(uint keyno_arg, Item* idx_cond_arg) +{ + pushed_idx_cond_keyno= keyno_arg; + pushed_idx_cond= idx_cond_arg; + in_range_check_pushed_down= TRUE; + if (active_index == pushed_idx_cond_keyno) + mi_set_index_cond_func(file, index_cond_func_myisam, this); + return NULL; +} + + struct st_mysql_storage_engine myisam_storage_engine= { MYSQL_HANDLERTON_INTERFACE_VERSION }; diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h index 7a1595573d4..76db0e89536 100644 --- a/storage/myisam/ha_myisam.h +++ b/storage/myisam/ha_myisam.h @@ -34,6 +34,10 @@ extern ulong myisam_sort_buffer_size; extern TYPELIB myisam_recover_typelib; extern ulong myisam_recover_options; +C_MODE_START +ICP_RESULT index_cond_func_myisam(void *arg); +C_MODE_END + class ha_myisam: public handler { MI_INFO *file; @@ -50,11 +54,15 @@ class ha_myisam: public handler const char *index_type(uint key_number); const char **bas_ext() const; ulonglong table_flags() const { return int_table_flags; } + int index_init(uint idx, bool sorted); + int index_end(); + int rnd_end(); + ulong index_flags(uint inx, uint part, bool all_parts) const { return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ? 0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE | - HA_READ_ORDER | HA_KEYREAD_ONLY); + HA_READ_ORDER | HA_KEYREAD_ONLY | HA_DO_INDEX_COND_PUSHDOWN); } uint max_supported_keys() const { return MI_MAX_KEY; } uint max_supported_key_length() const { return HA_MAX_KEY_LENGTH; } @@ -149,4 +157,23 @@ class ha_myisam: public handler { return file; } +public: + /** + * Multi Range Read interface + */ + int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, + uint n_ranges, uint mode, HANDLER_BUFFER *buf); + int multi_range_read_next(char **range_info); + ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, uint *bufsz, + uint *flags, COST_VECT *cost); + ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys, + uint *bufsz, uint *flags, COST_VECT *cost); + + /* Index condition pushdown implementation */ + Item *idx_cond_push(uint keyno, Item* idx_cond); +private: + DsMrr_impl ds_mrr; + friend ICP_RESULT index_cond_func_myisam(void *arg); }; diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c index 9c5dade28ab..7bb79108357 100644 --- a/storage/myisam/mi_extra.c +++ b/storage/myisam/mi_extra.c @@ -403,6 +403,12 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) DBUG_RETURN(error); } /* mi_extra */ +void mi_set_index_cond_func(MI_INFO *info, index_cond_func_t func, + void *func_arg) +{ + info->index_cond_func= func; + info->index_cond_func_arg= func_arg; +} /* Start/Stop Inserting Duplicates Into a Table, WL#1648. diff --git a/storage/myisam/mi_key.c b/storage/myisam/mi_key.c index 94f3f34ec58..aab5797a03b 100644 --- a/storage/myisam/mi_key.c +++ b/storage/myisam/mi_key.c @@ -31,7 +31,8 @@ set_if_smaller(char_length,length); \ } while(0) -static int _mi_put_key_in_record(MI_INFO *info,uint keynr,uchar *record); +static int _mi_put_key_in_record(MI_INFO *info,uint keynr, + my_bool unpack_blobs, uchar *record); /* Make a intern key from a record @@ -312,6 +313,9 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, _mi_put_key_in_record() info MyISAM handler keynr Key number that was used + unpack_blobs TRUE <=> Unpack blob columns + FALSE <=> Skip them. This is used by index condition + pushdown check function record Store key here Last read key is in info->lastkey @@ -325,7 +329,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, */ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr, - uchar *record) + my_bool unpack_blobs, uchar *record) { reg2 uchar *key; uchar *pos,*key_end; @@ -418,16 +422,19 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr, if (length > keyseg->length || key+length > key_end) goto err; #endif - memcpy(record+keyseg->start+keyseg->bit_start, - (char*) &blob_ptr,sizeof(char*)); - memcpy(blob_ptr,key,length); - blob_ptr+=length; + if (unpack_blobs) + { + memcpy(record+keyseg->start+keyseg->bit_start, + (char*) &blob_ptr,sizeof(char*)); + memcpy(blob_ptr,key,length); + blob_ptr+=length; - /* The above changed info->lastkey2. Inform mi_rnext_same(). */ - info->update&= ~HA_STATE_RNEXT_SAME; + /* The above changed info->lastkey2. Inform mi_rnext_same(). */ + info->update&= ~HA_STATE_RNEXT_SAME; - _mi_store_blob_length(record+keyseg->start, - (uint) keyseg->bit_start,length); + _mi_store_blob_length(record+keyseg->start, + (uint) keyseg->bit_start,length); + } key+=length; } else if (keyseg->flag & HA_SWAP_KEY) @@ -471,7 +478,7 @@ int _mi_read_key_record(MI_INFO *info, my_off_t filepos, uchar *buf) { if (info->lastinx >= 0) { /* Read only key */ - if (_mi_put_key_in_record(info,(uint) info->lastinx,buf)) + if (_mi_put_key_in_record(info,(uint) info->lastinx, TRUE, buf)) { mi_print_error(info->s, HA_ERR_CRASHED); my_errno=HA_ERR_CRASHED; @@ -487,6 +494,34 @@ int _mi_read_key_record(MI_INFO *info, my_off_t filepos, uchar *buf) /* + Save current key tuple to record and call index condition check function + + SYNOPSIS + mi_check_index_cond() + info MyISAM handler + keynr Index we're running a scan on + record Record buffer to use (it is assumed that index check function + will look for column values there) + + RETURN + -1 Error + 0 Index condition is not satisfied, continue scanning + 1 Index condition is satisfied + 2 Index condition is not satisfied, end the scan. +*/ + +int mi_check_index_cond(register MI_INFO *info, uint keynr, uchar *record) +{ + if (_mi_put_key_in_record(info, keynr, FALSE, record)) + { + mi_print_error(info->s, HA_ERR_CRASHED); + my_errno=HA_ERR_CRASHED; + return -1; + } + return info->index_cond_func(info->index_cond_func_arg); +} + +/* Retrieve auto_increment info SYNOPSIS diff --git a/storage/myisam/mi_rkey.c b/storage/myisam/mi_rkey.c index f20b0366683..47e2ce51a9e 100644 --- a/storage/myisam/mi_rkey.c +++ b/storage/myisam/mi_rkey.c @@ -29,6 +29,7 @@ int mi_rkey(MI_INFO *info, uchar *buf, int inx, const uchar *key, MI_KEYDEF *keyinfo; HA_KEYSEG *last_used_keyseg; uint pack_key_length, use_key_length, nextflag; + int res= 0; DBUG_ENTER("mi_rkey"); DBUG_PRINT("enter", ("base: 0x%lx buf: 0x%lx inx: %d search_flag: %d", (long) info, (long) buf, inx, search_flag)); @@ -105,55 +106,62 @@ int mi_rkey(MI_INFO *info, uchar *buf, int inx, const uchar *key, saved the current data_file_length. Concurrent inserts always go to the end of the file. So we can test if the found key references a new record. + + If we are searching for a partial key (or using >, >=, < or <=) and + the data is outside of the data file, we need to continue searching + for the first key inside the data file. + + We do also continue searching if an index condition check function + is available. */ - if (info->lastpos >= info->state->data_file_length) + while ((info->lastpos >= info->state->data_file_length && + (search_flag != HA_READ_KEY_EXACT || + last_used_keyseg != keyinfo->seg + keyinfo->keysegs)) || + (info->index_cond_func && + !(res= mi_check_index_cond(info, inx, buf)))) { - /* The key references a concurrently inserted record. */ + uint not_used[2]; + /* + Skip rows that are inserted by other threads since we got a lock + Note that this can only happen if we are not searching after an + full length exact key, because the keys are sorted + according to position + */ + if (_mi_search_next(info, keyinfo, info->lastkey, + info->lastkey_length, + myisam_readnext_vec[search_flag], + info->s->state.key_root[inx])) + break; + /* + Check that the found key does still match the search. + _mi_search_next() delivers the next key regardless of its + value. + */ if (search_flag == HA_READ_KEY_EXACT && - last_used_keyseg == keyinfo->seg + keyinfo->keysegs) + ha_key_cmp(keyinfo->seg, key_buff, info->lastkey, use_key_length, + SEARCH_FIND, not_used)) { - /* Simply ignore the key if it matches exactly. (Bug #29838) */ my_errno= HA_ERR_KEY_NOT_FOUND; info->lastpos= HA_OFFSET_ERROR; + break; } - else - { - /* - If searching for a partial key (or using >, >=, < or <=) and - the data is outside of the data file, we need to continue - searching for the first key inside the data file. - */ - do - { - uint not_used[2]; - /* - Skip rows that are inserted by other threads since we got - a lock. Note that this can only happen if we are not - searching after a full length exact key, because the keys - are sorted according to position. - */ - if (_mi_search_next(info, keyinfo, info->lastkey, - info->lastkey_length, - myisam_readnext_vec[search_flag], - info->s->state.key_root[inx])) - break; /* purecov: inspected */ - /* - Check that the found key does still match the search. - _mi_search_next() delivers the next key regardless of its - value. - */ - if (search_flag == HA_READ_KEY_EXACT && - ha_key_cmp(keyinfo->seg, key_buff, info->lastkey, - use_key_length, SEARCH_FIND, not_used)) - { - /* purecov: begin inspected */ - my_errno= HA_ERR_KEY_NOT_FOUND; - info->lastpos= HA_OFFSET_ERROR; - break; - /* purecov: end */ - } - } while (info->lastpos >= info->state->data_file_length); - } + } + if (res == 2) + { + info->lastpos= HA_OFFSET_ERROR; + if (share->concurrent_insert) + rw_unlock(&share->key_root_lock[inx]); + DBUG_RETURN((my_errno= HA_ERR_KEY_NOT_FOUND)); + } + /* + Error if no row found within the data file. (Bug #29838) + Do not overwrite my_errno if already at HA_OFFSET_ERROR. + */ + if (info->lastpos != HA_OFFSET_ERROR && + info->lastpos >= info->state->data_file_length) + { + info->lastpos= HA_OFFSET_ERROR; + my_errno= HA_ERR_KEY_NOT_FOUND; } } } diff --git a/storage/myisam/mi_rnext.c b/storage/myisam/mi_rnext.c index 7ce66d41e0f..ad5ec60dc98 100644 --- a/storage/myisam/mi_rnext.c +++ b/storage/myisam/mi_rnext.c @@ -28,6 +28,7 @@ int mi_rnext(MI_INFO *info, uchar *buf, int inx) { int error,changed; uint flag; + int res= 0; DBUG_ENTER("mi_rnext"); if ((inx = _mi_check_index(info,inx)) < 0) @@ -81,23 +82,36 @@ int mi_rnext(MI_INFO *info, uchar *buf, int inx) } } - if (info->s->concurrent_insert) + if (!error) { - if (!error) + while ((info->s->concurrent_insert && + info->lastpos >= info->state->data_file_length) || + (info->index_cond_func && + !(res= mi_check_index_cond(info, inx, buf)))) { - while (info->lastpos >= info->state->data_file_length) - { - /* Skip rows inserted by other threads since we got a lock */ - if ((error=_mi_search_next(info,info->s->keyinfo+inx, - info->lastkey, - info->lastkey_length, - SEARCH_BIGGER, - info->s->state.key_root[inx]))) - break; - } + /* + Skip rows that are either inserted by other threads since + we got a lock or do not match pushed index conditions + */ + if ((error=_mi_search_next(info,info->s->keyinfo+inx, + info->lastkey, + info->lastkey_length, + SEARCH_BIGGER, + info->s->state.key_root[inx]))) + break; + } + if (!error && res == 2) + { + if (info->s->concurrent_insert) + rw_unlock(&info->s->key_root_lock[inx]); + info->lastpos= HA_OFFSET_ERROR; + DBUG_RETURN(my_errno= HA_ERR_END_OF_FILE); } - rw_unlock(&info->s->key_root_lock[inx]); } + + if (info->s->concurrent_insert) + rw_unlock(&info->s->key_root_lock[inx]); + /* Don't clear if database-changed */ info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); info->update|= HA_STATE_NEXT_FOUND; diff --git a/storage/myisam/mi_rnext_same.c b/storage/myisam/mi_rnext_same.c index 1892fe3e1e0..76775dec8ac 100644 --- a/storage/myisam/mi_rnext_same.c +++ b/storage/myisam/mi_rnext_same.c @@ -76,7 +76,8 @@ int mi_rnext_same(MI_INFO *info, uchar *buf) break; } /* Skip rows that are inserted by other threads since we got a lock */ - if (info->lastpos < info->state->data_file_length) + if (info->lastpos < info->state->data_file_length && + (!info->index_cond_func || mi_check_index_cond(info, inx, buf))) break; } } diff --git a/storage/myisam/mi_rprev.c b/storage/myisam/mi_rprev.c index d1407012590..93bd224bd56 100644 --- a/storage/myisam/mi_rprev.c +++ b/storage/myisam/mi_rprev.c @@ -51,22 +51,36 @@ int mi_rprev(MI_INFO *info, uchar *buf, int inx) error=_mi_search(info,share->keyinfo+inx,info->lastkey, USE_WHOLE_KEY, flag, share->state.key_root[inx]); - if (share->concurrent_insert) + if (!error) { - if (!error) + int res= 0; + while ((share->concurrent_insert && + info->lastpos >= info->state->data_file_length) || + (info->index_cond_func && + !(res= mi_check_index_cond(info, inx, buf)))) { - while (info->lastpos >= info->state->data_file_length) - { - /* Skip rows that are inserted by other threads since we got a lock */ - if ((error=_mi_search_next(info,share->keyinfo+inx,info->lastkey, - info->lastkey_length, - SEARCH_SMALLER, - share->state.key_root[inx]))) - break; - } + /* + Skip rows that are either inserted by other threads since + we got a lock or do not match pushed index conditions + */ + if ((error=_mi_search_next(info,share->keyinfo+inx,info->lastkey, + info->lastkey_length, + SEARCH_SMALLER, + share->state.key_root[inx]))) + break; + } + if (!error && res == 2) + { + if (share->concurrent_insert) + rw_unlock(&share->key_root_lock[inx]); + info->lastpos= HA_OFFSET_ERROR; + DBUG_RETURN(my_errno= HA_ERR_END_OF_FILE); } - rw_unlock(&share->key_root_lock[inx]); } + + if (share->concurrent_insert) + rw_unlock(&share->key_root_lock[inx]); + info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); info->update|= HA_STATE_PREV_FOUND; if (error) diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h index c2841c49199..2dcd008da58 100644 --- a/storage/myisam/myisamdef.h +++ b/storage/myisam/myisamdef.h @@ -232,6 +232,7 @@ typedef struct st_mi_isam_share rw_lock_t mmap_lock; } MYISAM_SHARE; +typedef ICP_RESULT (*index_cond_func_t)(void *param); struct st_myisam_info { @@ -300,6 +301,8 @@ struct st_myisam_info /* If info->buff has to be reread for rnext */ my_bool buff_used; my_bool once_flags; /* For MYISAMMRG */ + index_cond_func_t index_cond_func; /* Index condition function */ + void *index_cond_func_arg; /* parameter for the func */ #ifdef __WIN__ my_bool owned_by_merge; /* This MyISAM table is part of a merge union */ #endif @@ -724,6 +727,7 @@ void mi_setup_functions(register MYISAM_SHARE *share); my_bool mi_dynmap_file(MI_INFO *info, my_off_t size); void mi_remap_file(MI_INFO *info, my_off_t size); +int mi_check_index_cond(register MI_INFO *info, uint keynr, uchar *record); /* Functions needed by mi_check */ volatile int *killed_ptr(HA_CHECK *param); void mi_check_print_error _VARARGS((HA_CHECK *param, const char *fmt, ...)); @@ -732,6 +736,8 @@ void mi_check_print_info _VARARGS((HA_CHECK *param, const char *fmt, ...)); #ifdef THREAD pthread_handler_t thr_find_all_keys(void *arg); #endif +extern void mi_set_index_cond_func(MI_INFO *info, index_cond_func_t func, + void *func_arg); int flush_blocks(HA_CHECK *param, KEY_CACHE *key_cache, File file); #ifdef __cplusplus } diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 1cd4000846a..aa6e6a27a69 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -113,6 +113,12 @@ static pthread_cond_t commit_cond; static pthread_mutex_t commit_cond_m; static bool innodb_inited = 0; +C_MODE_START +static uint index_cond_func_innodb(void *arg); +C_MODE_END + + + #define INSIDE_HA_INNOBASE_CC /* In the Windows plugin, the return value of current_thd is @@ -3031,7 +3037,7 @@ ulong ha_innobase::index_flags(uint, uint, bool) const { return(HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER - | HA_READ_RANGE | HA_KEYREAD_ONLY); + | HA_READ_RANGE | HA_KEYREAD_ONLY | HA_DO_INDEX_COND_PUSHDOWN); } UNIV_INTERN @@ -3989,6 +3995,7 @@ build_template( only if templ_type is ROW_MYSQL_REC_FIELDS */ TABLE* table, /* in: MySQL table */ + ha_innobase* file, /* in: ha_innobase handler */ uint templ_type) /* in: ROW_MYSQL_WHOLE_ROW or ROW_MYSQL_REC_FIELDS */ { @@ -4000,10 +4007,12 @@ build_template( ulint n_requested_fields = 0; ibool fetch_all_in_key = FALSE; ibool fetch_primary_key_cols = FALSE; - ulint i, sql_idx, innodb_idx=0; + ulint sql_idx, innodb_idx=0; /* byte offset of the end of last requested column */ ulint mysql_prefix_len = 0; - + ibool do_idx_cond_push= FALSE; + ibool need_second_pass= FALSE; + if (prebuilt->select_lock_type == LOCK_X) { /* We always retrieve the whole clustered index record if we use exclusive row level locks, for example, if the read is @@ -4073,6 +4082,16 @@ build_template( prebuilt->templ_contains_blob = FALSE; + + /* + Setup index condition pushdown (note: we don't need to check if + this is a scan on primary key as that is checked in idx_cond_push) + */ + if (file->active_index == file->pushed_idx_cond_keyno && + file->active_index != MAX_KEY && + templ_type == ROW_MYSQL_REC_FIELDS) + do_idx_cond_push= need_second_pass= TRUE; + /* Note that in InnoDB, i is the column number. MySQL calls columns 'fields'. */ for (sql_idx = 0; sql_idx < n_fields; sql_idx++) { @@ -4086,6 +4105,8 @@ build_template( and which we can skip. */ register const ibool index_contains_field = dict_index_contains_col_or_prefix(index, innodb_idx); + register const ibool index_covers_field = + field->part_of_key.is_set(file->active_index); if (!index_contains_field && prebuilt->read_just_key) { /* If this is a 'key read', we do not need @@ -4118,8 +4139,12 @@ build_template( /* This field is not needed in the query, skip it */ goto skip_field; - } include_field: + if (do_idx_cond_push && + ((need_second_pass && !index_covers_field) || + (!need_second_pass && index_covers_field))) + goto skip_field; + } n_requested_fields++; templ->col_no = innodb_idx; @@ -4173,6 +4198,13 @@ include_field: prebuilt->templ_contains_blob = TRUE; } skip_field: + if (need_second_pass && (sql_idx+1 == n_fields)) + { + prebuilt->n_index_fields= n_requested_fields; + need_second_pass= FALSE; + sql_idx= (~(ulint)0); /* to start from 0 */ + innodb_idx= (~(ulint)0); /* to start from 0 */ ///psergey-merge-merge-last-change + } if (field->stored_in_db) { innodb_idx++; } @@ -4181,12 +4213,23 @@ skip_field: prebuilt->n_template = n_requested_fields; prebuilt->mysql_prefix_len = mysql_prefix_len; + if (do_idx_cond_push) + { + prebuilt->idx_cond_func= index_cond_func_innodb; + prebuilt->idx_cond_func_arg= file; + } + else + { + prebuilt->idx_cond_func= NULL; + prebuilt->n_index_fields= n_requested_fields; + } + if (index != clust_index && prebuilt->need_to_access_clustered) { /* Change rec_field_no's to correspond to the clustered index record */ - for (i = 0; i < n_requested_fields; i++) { + for (ulint i = do_idx_cond_push? prebuilt->n_index_fields : 0; + i < n_requested_fields; i++) { templ = prebuilt->mysql_template + i; - templ->rec_field_no = dict_col_get_clust_pos( &index->table->cols[templ->col_no], clust_index); @@ -4505,7 +4548,7 @@ no_commit: /* Build the template used in converting quickly between the two database formats */ - build_template(prebuilt, NULL, table, ROW_MYSQL_WHOLE_ROW); + build_template(prebuilt, NULL, table, this, ROW_MYSQL_WHOLE_ROW); } innodb_srv_conc_enter_innodb(prebuilt->trx); @@ -5038,6 +5081,8 @@ ha_innobase::index_end(void) int error = 0; DBUG_ENTER("index_end"); active_index=MAX_KEY; + in_range_check_pushed_down= FALSE; + ds_mrr.dsmrr_close(); DBUG_RETURN(error); } @@ -5187,7 +5232,8 @@ ha_innobase::index_read( necessarily prebuilt->index, but can also be the clustered index */ if (prebuilt->sql_stat_start) { - build_template(prebuilt, user_thd, table, ROW_MYSQL_REC_FIELDS); + build_template(prebuilt, user_thd, table, this, + ROW_MYSQL_REC_FIELDS); } if (key_ptr) { @@ -5359,7 +5405,7 @@ ha_innobase::change_active_index( the flag ROW_MYSQL_WHOLE_ROW below, but that caused unnecessary copying. Starting from MySQL-4.1 we use a more efficient flag here. */ - build_template(prebuilt, user_thd, table, ROW_MYSQL_REC_FIELDS); + build_template(prebuilt, user_thd, table, this, ROW_MYSQL_REC_FIELDS); DBUG_RETURN(0); } @@ -7422,7 +7468,7 @@ ha_innobase::check( /* Build the template; we will use a dummy template in index scans done in checking */ - build_template(prebuilt, NULL, table, ROW_MYSQL_WHOLE_ROW); + build_template(prebuilt, NULL, table, this, ROW_MYSQL_WHOLE_ROW); } ret = row_check_table_for_mysql(prebuilt); @@ -7786,6 +7832,10 @@ ha_innobase::extra( break; case HA_EXTRA_RESET_STATE: reset_template(prebuilt); + /* Reset index condition pushdown state */ + pushed_idx_cond= FALSE; + pushed_idx_cond_keyno= MAX_KEY; + prebuilt->idx_cond_func= NULL; break; case HA_EXTRA_NO_KEYREAD: prebuilt->read_just_key = 0; @@ -7833,6 +7883,12 @@ ha_innobase::reset() reset_template(prebuilt); + /* Reset index condition pushdown state */ + pushed_idx_cond_keyno= MAX_KEY; + pushed_idx_cond= NULL; + ds_mrr.dsmrr_close(); + prebuilt->idx_cond_func= NULL; + /* TODO: This should really be reset in reset_template() but for now it's safer to do it explicitly here. */ @@ -10680,3 +10736,112 @@ test_innobase_convert_name() } #endif /* UNIV_COMPILE_TEST_FUNCS */ + + +/**************************************************************************** + * DS-MRR implementation + ***************************************************************************/ + +/** + * Multi Range Read interface, DS-MRR calls + */ + +int ha_innobase::multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, + uint n_ranges, uint mode, HANDLER_BUFFER *buf) +{ + return ds_mrr.dsmrr_init(this, seq, seq_init_param, n_ranges, mode, buf); +} + +int ha_innobase::multi_range_read_next(char **range_info) +{ + return ds_mrr.dsmrr_next(range_info); +} + +ha_rows ha_innobase::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, uint *bufsz, + uint *flags, + COST_VECT *cost) +{ + /* See comments in ha_myisam::multi_range_read_info_const */ + ds_mrr.init(this, table); + //psergey-mrr-fix: + if (prebuilt->select_lock_type != LOCK_NONE) + *flags |= HA_MRR_USE_DEFAULT_IMPL; + + uint orig_flags= *flags; + + ha_rows res= ds_mrr.dsmrr_info_const(keyno, seq, seq_init_param, n_ranges, + bufsz, flags, cost); + + bool disable_ds_mrr= true; + disable_ds_mrr= false; +// DBUG_EXECUTE_IF("optimizer_innodb_ds_mrr", disable_ds_mrr= false;); + if (!disable_ds_mrr) + return res; + + /* Disable DS-MRR: enable MS-MRR only after critical bugs are fixed */ + *bufsz= 0; + *flags = orig_flags | HA_MRR_USE_DEFAULT_IMPL; + return res; +} + +ha_rows ha_innobase::multi_range_read_info(uint keyno, uint n_ranges, + uint keys, uint *bufsz, + uint *flags, COST_VECT *cost) +{ + ds_mrr.init(this, table); + uint orig_flags= *flags; + + ha_rows res= ds_mrr.dsmrr_info(keyno, n_ranges, keys, bufsz, flags, cost); + bool disable_ds_mrr= false; + // DBUG_EXECUTE_IF("optimizer_innodb_ds_mrr", disable_ds_mrr= false;); + if (!disable_ds_mrr) + return res; + + /* Disable DS-MRR: enable MS-MRR only after critical bugs are fixed */ + *bufsz= 0; + *flags = orig_flags | HA_MRR_USE_DEFAULT_IMPL; + return res; +} + + + +/** + * Index Condition Pushdown interface implementation + */ + +C_MODE_START + +/* + Index condition check function to be called from within Innobase. + See note on ICP_RESULT for return values description. +*/ + +static uint index_cond_func_innodb(void *arg) +{ + ha_innobase *h= (ha_innobase*)arg; + if (h->end_range) + { + if (h->compare_key2(h->end_range) > 0) + return 2; /* caller should return HA_ERR_END_OF_FILE already */ + } + return test(h->pushed_idx_cond->val_int()); +} + +C_MODE_END + + +Item *ha_innobase::idx_cond_push(uint keyno_arg, Item* idx_cond_arg) +{ + // V :psergey-mrrr-merge: V + if (keyno_arg != primary_key && (prebuilt->select_lock_type == LOCK_NONE)) + { + pushed_idx_cond_keyno= keyno_arg; + pushed_idx_cond= idx_cond_arg; + in_range_check_pushed_down= TRUE; + return NULL; /* Table handler will check the entire condition */ + } + return idx_cond_arg; /* Table handler will not make any checks */ +} + diff --git a/storage/xtradb/handler/ha_innodb.h b/storage/xtradb/handler/ha_innodb.h index cf58a3ed972..d5a50a74d6f 100644 --- a/storage/xtradb/handler/ha_innodb.h +++ b/storage/xtradb/handler/ha_innodb.h @@ -205,6 +205,22 @@ class ha_innobase: public handler bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes); bool check_if_supported_virtual_columns(void) { return TRUE; } +public: + /** + * Multi Range Read interface + */ + int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, + uint n_ranges, uint mode, HANDLER_BUFFER *buf); + int multi_range_read_next(char **range_info); + ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, uint *bufsz, + uint *flags, COST_VECT *cost); + ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys, + uint *bufsz, uint *flags, COST_VECT *cost); + DsMrr_impl ds_mrr; + + Item *idx_cond_push(uint keyno, Item* idx_cond); }; /* Some accessor functions which the InnoDB plugin needs, but which diff --git a/storage/xtradb/include/row0mysql.h b/storage/xtradb/include/row0mysql.h index 8e42c316209..e1a73cab58d 100644 --- a/storage/xtradb/include/row0mysql.h +++ b/storage/xtradb/include/row0mysql.h @@ -564,6 +564,8 @@ struct mysql_row_templ_struct { #define ROW_PREBUILT_ALLOCATED 78540783 #define ROW_PREBUILT_FREED 26423527 +typedef uint (*index_cond_func_t)(void *param); + /* A struct for (sometimes lazily) prebuilt structures in an Innobase table handle used within MySQL; these are used to save CPU time. */ @@ -756,6 +758,14 @@ struct row_prebuilt_struct { /*----------------------*/ UT_LIST_NODE_T(row_prebuilt_t) prebuilts; /* list node of table->prebuilts */ + /*----------------------*/ + index_cond_func_t idx_cond_func;/* Index Condition Pushdown function, + or NULL if there is none set */ + void* idx_cond_func_arg;/* ICP function argument */ + ulint n_index_fields; /* Number of fields at the start of + mysql_template. Valid only when using + ICP. */ + /*----------------------*/ ulint magic_n2; /* this should be the same as magic_n */ }; diff --git a/storage/xtradb/row/row0sel.c b/storage/xtradb/row/row0sel.c index fb1523d3370..95df05c8ff0 100644 --- a/storage/xtradb/row/row0sel.c +++ b/storage/xtradb/row/row0sel.c @@ -2682,8 +2682,10 @@ row_sel_store_mysql_rec( which was described in prebuilt's template; must be protected by a page latch */ - const ulint* offsets) /* in: array returned by + const ulint* offsets, /* in: array returned by rec_get_offsets() */ + ulint start_field_no, /* in: start from this field */ + ulint end_field_no) /* in: end at this field */ { mysql_row_templ_t* templ; mem_heap_t* extern_field_heap = NULL; @@ -2701,7 +2703,7 @@ row_sel_store_mysql_rec( prebuilt->blob_heap = NULL; } - for (i = 0; i < prebuilt->n_template; i++) { + for (i = start_field_no; i < end_field_no /* prebuilt->n_template */ ; i++) { templ = prebuilt->mysql_template + i; @@ -3143,7 +3145,10 @@ row_sel_push_cache_row_for_mysql( row_prebuilt_t* prebuilt, /* in: prebuilt struct */ const rec_t* rec, /* in: record to push; must be protected by a page latch */ - const ulint* offsets) /* in: rec_get_offsets() */ + const ulint* offsets, /* in: rec_get_offsets() */ + ulint start_field_no, /* in: start from this field */ + byte* remainder_buf) /* in: if start_field_no !=0, + where to take prev fields */ { byte* buf; ulint i; @@ -3174,12 +3179,43 @@ row_sel_push_cache_row_for_mysql( ut_ad(prebuilt->fetch_cache_first == 0); if (UNIV_UNLIKELY(!row_sel_store_mysql_rec( - prebuilt->fetch_cache[ + prebuilt->fetch_cache[ prebuilt->n_fetch_cached], - prebuilt, rec, offsets))) { + prebuilt, + rec, + offsets, + start_field_no, + prebuilt->n_template))) { ut_error; } + if (start_field_no) { + + for (i=0; i < start_field_no; i++) { + register ulint offs; + mysql_row_templ_t* templ; + register byte * null_byte; + + templ = prebuilt->mysql_template + i; + + if (templ->mysql_null_bit_mask) { + offs = templ->mysql_null_byte_offset; + + null_byte= prebuilt->fetch_cache[ + prebuilt->n_fetch_cached]+offs; + (*null_byte)&= ~templ->mysql_null_bit_mask; + (*null_byte)|= (*(remainder_buf + offs) & + templ->mysql_null_bit_mask); + } + + offs = templ->mysql_col_offset; + memcpy(prebuilt->fetch_cache[prebuilt->n_fetch_cached] + + offs, + remainder_buf + offs, + templ->mysql_col_len); + } + } + prebuilt->n_fetch_cached++; } @@ -3318,6 +3354,10 @@ row_search_for_mysql( mem_heap_t* heap = NULL; ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint* offsets = offsets_; + /*psergey-mrr:*/ + ibool some_fields_in_buffer; + ibool get_clust_rec = 0; + /*:psergey-mrr*/ rec_offs_init(offsets_); @@ -3570,7 +3610,8 @@ row_search_for_mysql( mtr_commit(&mtr). */ if (!row_sel_store_mysql_rec(buf, prebuilt, - rec, offsets)) { + rec, offsets, 0, + prebuilt->n_template)) { err = DB_TOO_BIG_RECORD; /* We let the main loop to do the @@ -4169,8 +4210,11 @@ no_gap_lock: information via the clustered index record. */ ut_ad(index != clust_index); - - goto requires_clust_rec; + /*psergey-mrr:*/ + get_clust_rec = TRUE; + goto idx_cond_check; + /**goto requires_clust_rec;**/ + /*:psergey-mrr*/ } } @@ -4214,12 +4258,30 @@ no_gap_lock: goto next_rec; } + +idx_cond_check: + if (prebuilt->idx_cond_func) + { + int res; + ut_ad(prebuilt->template_type != ROW_MYSQL_DUMMY_TEMPLATE); + offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap); + row_sel_store_mysql_rec(buf, prebuilt, rec, + offsets, 0, prebuilt->n_index_fields); + res= prebuilt->idx_cond_func(prebuilt->idx_cond_func_arg); + if (res == 0) + goto next_rec; + if (res == 2) + { + err = DB_RECORD_NOT_FOUND; + goto idx_cond_failed; + } + } + /* Get the clustered index record if needed, if we did not do the search using the clustered index. */ + if (get_clust_rec || (index != clust_index + && prebuilt->need_to_access_clustered)) { - if (index != clust_index && prebuilt->need_to_access_clustered) { - -requires_clust_rec: /* We use a 'goto' to the preceding label if a consistent read of a secondary index record requires us to look up old versions of the associated clustered index record. */ @@ -4322,9 +4384,15 @@ requires_clust_rec: are BLOBs in the fields to be fetched. In HANDLER we do not cache rows because there the cursor is a scrollable cursor. */ - - row_sel_push_cache_row_for_mysql(prebuilt, result_rec, - offsets); + some_fields_in_buffer = (index != clust_index + && prebuilt->idx_cond_func); + + row_sel_push_cache_row_for_mysql(prebuilt, + result_rec, + offsets, + some_fields_in_buffer? + prebuilt->n_index_fields : 0, + buf); if (prebuilt->n_fetch_cached == MYSQL_FETCH_CACHE_SIZE) { goto got_row; @@ -4340,7 +4408,10 @@ requires_clust_rec: rec_offs_extra_size(offsets) + 4); } else { if (!row_sel_store_mysql_rec(buf, prebuilt, - result_rec, offsets)) { + result_rec, offsets, + prebuilt->idx_cond_func? + prebuilt->n_index_fields: 0, + prebuilt->n_template)) { err = DB_TOO_BIG_RECORD; goto lock_wait_or_error; @@ -4368,6 +4439,9 @@ got_row: HANDLER command where the user can move the cursor with PREV or NEXT even after a unique search. */ + err = DB_SUCCESS; + +idx_cond_failed: if (!unique_search_from_clust_index || prebuilt->select_lock_type != LOCK_NONE || prebuilt->used_in_HANDLER) { @@ -4377,12 +4451,11 @@ got_row: btr_pcur_store_position(pcur, &mtr); } - err = DB_SUCCESS; - goto normal_return; next_rec: /* Reset the old and new "did semi-consistent read" flags. */ + get_clust_rec = FALSE; if (UNIV_UNLIKELY(prebuilt->row_read_type == ROW_READ_DID_SEMI_CONSISTENT)) { prebuilt->row_read_type = ROW_READ_TRY_SEMI_CONSISTENT; diff --git a/support-files/build-tags b/support-files/build-tags index b5386dc79c3..1737910a692 100755 --- a/support-files/build-tags +++ b/support-files/build-tags @@ -4,7 +4,7 @@ rm -f TAGS filter='\.cc$\|\.c$\|\.h$\|\.yy$' list="find . -type f" -bzr root >/dev/null 2>/dev/null && list="bzr ls --from-root -R --kind=file --versioned" +bzr root >/dev/null 2>/dev/null && list="bzr ls --from-root --kind=file --versioned" $list |grep $filter |while read f; do |