⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 innodb.test

📁 开启mysql的远程连接的方法 mysql-noinstall-5.1.6-alpha-win32.zip
💻 TEST
📖 第 1 页 / 共 4 页
字号:
select * from t1;select * from t2;drop table t1,t2;CREATE TABLE t2 (   NEXT_T         BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM;CREATE TABLE t1 (  B_ID           INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;SET AUTOCOMMIT=0;INSERT INTO t1 ( B_ID ) VALUES ( 1 );INSERT INTO t2 ( NEXT_T ) VALUES ( 1 );ROLLBACK;SELECT * FROM t1;drop table  t1,t2;create table t1  ( pk         int primary key,    parent     int not null,    child      int not null,       index (parent)  ) engine = innodb;insert into t1 values   (1,0,4),  (2,1,3),  (3,2,1),  (4,1,2);select distinct  parent,child   from t1   order by parent;drop table t1;## Test that MySQL priorities clustered indexes#create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) engine=innodb;create table t2 (a int not null auto_increment primary key, b int);insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null);insert into t2 (a) select b from t1;insert into t1 (b) select b from t2;insert into t2 (a) select b from t1;insert into t1 (a) select b from t2;insert into t2 (a) select b from t1;insert into t1 (a) select b from t2;insert into t2 (a) select b from t1;insert into t1 (a) select b from t2;insert into t2 (a) select b from t1;insert into t1 (a) select b from t2;insert into t2 (a) select b from t1;insert into t1 (a) select b from t2;insert into t2 (a) select b from t1;insert into t1 (a) select b from t2;insert into t2 (a) select b from t1;insert into t1 (a) select b from t2;insert into t2 (a) select b from t1;insert into t1 (a) select b from t2;select count(*) from t1;--replace_column 9 #explain select * from t1 where c between 1 and 10000;update t1 set c=a;--replace_column 9 #explain select * from t1 where c between 1 and 10000;drop table t1,t2;## Test of UPDATE ... ORDER BY#create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb;insert into t1 (id) values (null),(null),(null),(null),(null);update t1 set fk=69 where fk is null order by id limit 1;SELECT * from t1;drop table t1;create table t1 (a int not null, b int not null, key (a));insert into t1 values (1,1),(1,2),(1,3),(3,1),(3,2),(3,3),(3,1),(3,2),(3,3),(2,1),(2,2),(2,3);SET @tmp=0;update t1 set b=(@tmp:=@tmp+1) order by a;update t1 set b=99 where a=1 order by b asc limit 1;update t1 set b=100 where a=1 order by b desc limit 2;update t1 set a=a+10+b where a=1 order by b;select * from t1 order by a,b;drop table t1;## Test of multi-table-updates (bug #1980).#create table t1 ( c char(8) not null ) engine=innodb;insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');alter table t1 add b char(8) not null;alter table t1 add a char(8) not null;alter table t1 add primary key (a,b,c);update t1 set a=c, b=c;create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=innodb;insert into t2 select * from t1;delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;drop table t1,t2;## test autoincrement with TRUNCATE#SET AUTOCOMMIT=1;create table t1 (a integer auto_increment primary key) engine=innodb;insert into t1 (a) values (NULL),(NULL);truncate table t1;insert into t1 (a) values (NULL),(NULL);SELECT * from t1;drop table t1;## Test dictionary handling with spaceand quoting#CREATE TABLE t1 (`id 1` INT NOT NULL, PRIMARY KEY (`id 1`)) ENGINE=INNODB;CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (`t1_id`) REFERENCES `t1`(`id 1`)  ON DELETE CASCADE ) ENGINE=INNODB;#show create table t2;drop table t2,t1;## Test of multi updated and foreign keys#create table `t1` (`id` int( 11 ) not null  ,primary key ( `id` )) engine = innodb;insert into `t1`values ( 1 ) ;create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) engine = innodb;insert into `t2`values ( 1 ) ;create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = innodb;insert into `t3`values ( 1 ) ;--error 1451delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;--error 1451update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7  where t1.id =1 and t2.id = t1.id and t3.id = t2.id;--error 1054update t3 set  t3.id=7  where t1.id =1 and t2.id = t1.id and t3.id = t2.id;drop table t3,t2,t1;## test for recursion depth limit#create table t1(	id int primary key,	pid int,	index(pid),	foreign key(pid) references t1(id) on delete cascade) engine=innodb;insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),	(8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14);-- error 1451delete from t1 where id=0;delete from t1 where id=15;delete from t1 where id=0;drop table t1;## Test timestamps#CREATE TABLE t1 (col1 int(1))ENGINE=InnoDB;CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx(stamp))ENGINE=InnoDB;insert into t1 values (1),(2),(3);# Note that timestamp 3 is wronginsert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ),(5,20020204230000);SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp <'20020204120000' GROUP BY col1;drop table t1,t2;## Test by Francois MASUREL#CREATE TABLE t1 (  `id` int(10) unsigned NOT NULL auto_increment,  `id_object` int(10) unsigned default '0',  `id_version` int(10) unsigned NOT NULL default '1',  `label` varchar(100) NOT NULL default '',  `description` text,  PRIMARY KEY  (`id`),  KEY `id_object` (`id_object`),  KEY `id_version` (`id_version`)) ENGINE=InnoDB;INSERT INTO t1 VALUES("6", "3382", "9", "Test", NULL), ("7", "102", "5", "Le Pekin (Test)", NULL),("584", "1794", "4", "Test de resto", NULL),("837", "1822", "6", "Test 3", NULL),("1119", "3524", "1", "Societe Test", NULL),("1122", "3525", "1", "Fournisseur Test", NULL);CREATE TABLE t2 (  `id` int(10) unsigned NOT NULL auto_increment,  `id_version` int(10) unsigned NOT NULL default '1',  PRIMARY KEY  (`id`),  KEY `id_version` (`id_version`)) ENGINE=InnoDB;INSERT INTO t2 VALUES("3524", "1"),("3525", "1"),("1794", "4"),("102", "5"),("1822", "6"),("3382", "9");SELECT t2.id, t1.`label` FROM t2 INNER JOIN(SELECT t1.id_object as id_object FROM t1 WHERE t1.`label` LIKE '%test%') AS lbl ON (t2.id = lbl.id_object) INNER JOIN t1 ON (t2.id = t1.id_object);drop table t1,t2;create table t1 (a int, b varchar(200), c text not null) checksum=1 engine=myisam;create table t2 (a int, b varchar(200), c text not null) checksum=0 engine=innodb;create table t3 (a int, b varchar(200), c text not null) checksum=1 engine=innodb;insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");insert t2 select * from t1;insert t3 select * from t1;checksum table t1, t2, t3, t4 quick;checksum table t1, t2, t3, t4;checksum table t1, t2, t3, t4 extended;#show table status;drop table t1,t2,t3;## Test problem with refering to different fields in same table in UNION# (Bug #2552)#create table t1 (id int,  name char(10) not null,  name2 char(10) not null) engine=innodb;insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');select name2 from t1  union all  select name from t1 union all select id from t1;drop table t1;## Bug2160#create table t1 (a int) engine=innodb;create table t2 like t1;drop table t1,t2;## Test of automaticly created foreign keys#create table t1 (id int(11) not null, id2 int(11) not null, unique (id,id2)) engine=innodb;create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) references t1 (id)) engine = innodb;show create table t1;show create table t2;create index id on t2 (id);show create table t2;create index id2 on t2 (id);show create table t2;drop index id2 on t2;--error 1025,1025drop index id on t2;show create table t2;drop table t2;create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id,id2) references t1 (id,id2)) engine = innodb;show create table t2;create unique index id on t2 (id,id2);show create table t2;drop table t2;# Check foreign key columns created in different order than key columnscreate table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;show create table t2;drop table t2;create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = innodb;show create table t2;drop table t2;create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;show create table t2;drop table t2;create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id), primary key (id), index (id,id2)) engine = innodb;show create table t2;drop table t2;create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id)) engine= innodb;show create table t2;alter table t2 add index id_test (id), add index id_test2 (id,id2);show create table t2;drop table t2;# Test error handling# Clean up filename -- embedded server reports whole path without .frm,# regular server reports relative path with .frm (argh!)--replace_result \\ / $MYSQL_TEST_DIR . /var/master-data/ / t2.frm t2--error 1005create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;# bug#3749create table t2 (a int auto_increment primary key, b int, index(b), foreign key (b) references t1(id), unique(b)) engine=innodb;show create table t2;drop table t2;create table t2 (a int auto_increment primary key, b int, foreign key (b) references t1(id), foreign key (b) references t1(id), unique(b)) engine=innodb;show create table t2;drop table t2, t1;## Bug #6126: Duplicate columns in keys gives misleading error message#--error 1060create table t1 (c char(10), index (c,c)) engine=innodb;--error 1060create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;--error 1060create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;--error 1060create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;create table t1 (c1 char(10), c2 char(10)) engine=innodb;--error 1060alter table t1 add key (c1,c1);--error 1060alter table t1 add key (c2,c1,c1);--error 1060alter table t1 add key (c1,c2,c1);--error 1060alter table t1 add key (c1,c1,c2);drop table t1;## Bug #4082: integer truncation#create table t1(a int(1) , b int(1)) engine=innodb;insert into t1 values ('1111', '3333');select distinct concat(a, b) from t1;drop table t1;## BUG#7709 test case - Boolean fulltext query against unsupported #                      engines does not fail#CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;--error 1214SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);DROP TABLE t1;## check null values #1#--disable_warningsCREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY  (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1;INSERT INTO t1 VALUES (1),(2),(3);CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY  (b_id), KEY  (b_a),                 CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1;--enable_warningsINSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2);SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz;DROP TABLE t2;DROP TABLE t1;## Bug#11816 - Truncate table doesn't work with temporary innodb tables# This is not an innodb bug, but we test it using innodb.#create temporary table t1 (a int) engine=innodb;insert into t1 values (4711);truncate t1;insert into t1 values (42);select * from t1;drop table t1;# Show that it works with permanent tables too.create table t1 (a int) engine=innodb;insert into t1 values (4711);truncate t1;insert into t1 values (42);select * from t1;drop table t1;## Bug #13025  Server crash during filesort	#create table t1 (a int not null, b int not null, c blob not null, d int not null, e int, primary key (a,b,c(255),d)) engine=innodb;insert into t1 values (2,2,"b",2,2),(1,1,"a",1,1),(3,3,"ab",3,3);select * from t1 order by a,b,c,d;explain select * from t1 order by a,b,c,d;drop table t1;## BUG#11039,#13218 Wrong key length in min()#create table t1 (a char(1), b char(1), key(a, b)) engine=innodb;insert into t1 values ('8', '6'), ('4', '7');select min(a) from t1;select min(b) from t1 where a='8';drop table t1;# End of 4.1 tests## range optimizer problem#create table t1 (x bigint unsigned not null primary key) engine=innodb;insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);select * from t1;select count(*) from t1 where x>0;select count(*) from t1 where x=0;select count(*) from t1 where x<0;select count(*) from t1 where x < -16;select count(*) from t1 where x = -16;explain select count(*) from t1 where x > -16;select count(*) from t1 where x > -16;select * from t1 where x > -16;select count(*) from t1 where x = 18446744073709551601;drop table t1;# Test for row locks InnoDB status variables.show status like "Innodb_row_lock_waits";show status like "Innodb_row_lock_current_waits";show status like "Innodb_row_lock_time";show status like "Innodb_row_lock_time_max";show status like "Innodb_row_lock_time_avg";# Test for innodb_sync_spin_loops variableshow variables like "innodb_sync_spin_loops";set global innodb_sync_spin_loops=1000;show variables like "innodb_sync_spin_loops";set global innodb_sync_spin_loops=0;show variables like "innodb_sync_spin_loops";set global innodb_sync_spin_loops=20;show variables like "innodb_sync_spin_loops";# Test for innodb_thread_concurrency variableshow variables like "innodb_thread_concurrency";set global innodb_thread_concurrency=1000;show variables like "innodb_thread_concurrency";set global innodb_thread_concurrency=0;show variables like "innodb_thread_concurrency";set global innodb_thread_concurrency=16;show variables like "innodb_thread_concurrency";# Test for innodb_concurrency_tickets variableshow variables like "innodb_concurrency_tickets";set global innodb_concurrency_tickets=1000;show variables like "innodb_concurrency_tickets";set global innodb_concurrency_tickets=0;show variables like "innodb_concurrency_tickets";set global innodb_concurrency_tickets=500;show variables like "innodb_concurrency_tickets";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -