296
321
Table Op Msg_type Msg_text
297
322
test.t1 check status OK
299
CREATE TEMPORARY TABLE t1 (a varchar(300), b varchar(300), c varchar(300), d varchar(300), e varchar(300), KEY t1 (a, b, c, d, e)) ENGINE=MyISAM;
324
CREATE TABLE t1 (a varchar(300), b varchar(300), c varchar(300), d varchar(300), e varchar(300), KEY t1 (a, b, c, d, e)) ENGINE=MyISAM;
300
325
ERROR 42000: Specified key was too long; max key length is 1332 bytes
301
CREATE TEMPORARY TABLE t1 (a varchar(300), b varchar(300), c varchar(300), d varchar(300), e varchar(300)) ENGINE=MyISAM;
326
CREATE TABLE t1 (a varchar(300), b varchar(300), c varchar(300), d varchar(300), e varchar(300)) ENGINE=MyISAM;
302
327
ALTER TABLE t1 ADD INDEX t1 (a, b, c, d, e);
303
328
ERROR 42000: Specified key was too long; max key length is 1332 bytes
305
CREATE TEMPORARY TABLE t1 (a int not null, b int, c int, key(b), key(c), key(a,b), key(c,a)) ENGINE=MyISAM;
330
CREATE TABLE t1 (a int not null, b int, c int, key(b), key(c), key(a,b), key(c,a)) ENGINE=MyISAM;
306
331
INSERT into t1 values (0, null, 0), (0, null, 1), (0, null, 2), (0, null,3), (1,1,4);
307
create temporary table t2 (a int not null, b int, c int, key(b), key(c), key(a)) engine=myisam;
332
create table t2 (a int not null, b int, c int, key(b), key(c), key(a));
308
333
INSERT into t2 values (1,1,1), (2,2,2);
309
alter table t1 ENGINE=MYISAM;
335
Table Op Msg_type Msg_text
336
test.t1 optimize status OK
310
337
show index from t1;
311
Table Unique Key_name Seq_in_index Column_name
338
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
339
t1 1 b 1 b A 5 NULL NULL YES BTREE
340
t1 1 c 1 c A 5 NULL NULL YES BTREE
341
t1 1 a 1 a A 1 NULL NULL BTREE
342
t1 1 a 2 b A 5 NULL NULL YES BTREE
343
t1 1 c_2 1 c A 5 NULL NULL YES BTREE
344
t1 1 c_2 2 a A 5 NULL NULL BTREE
318
345
explain select * from t1,t2 where t1.a=t2.a;
319
346
id select_type table type possible_keys key key_len ref rows Extra
320
347
1 SIMPLE t2 ALL a NULL NULL NULL 2
321
1 SIMPLE t1 ref a a 4 test.t2.a 1
348
1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where; Using join buffer
322
349
explain select * from t1,t2 force index(a) where t1.a=t2.a;
323
350
id select_type table type possible_keys key key_len ref rows Extra
324
351
1 SIMPLE t2 ALL a NULL NULL NULL 2
325
1 SIMPLE t1 ref a a 4 test.t2.a 1
352
1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where; Using join buffer
326
353
explain select * from t1 force index(a),t2 force index(a) where t1.a=t2.a;
327
354
id select_type table type possible_keys key key_len ref rows Extra
328
355
1 SIMPLE t2 ALL a NULL NULL NULL 2
329
1 SIMPLE t1 ref a a 4 test.t2.a 1
356
1 SIMPLE t1 ref a a 4 test.t2.a 3
330
357
explain select * from t1,t2 where t1.b=t2.b;
331
358
id select_type table type possible_keys key key_len ref rows Extra
332
359
1 SIMPLE t2 ALL b NULL NULL NULL 2
333
1 SIMPLE t1 ALL b NULL NULL NULL 5 Using where; Using join buffer
360
1 SIMPLE t1 ref b b 5 test.t2.b 1
334
361
explain select * from t1,t2 force index(c) where t1.a=t2.a;
335
362
id select_type table type possible_keys key key_len ref rows Extra
336
363
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
337
1 SIMPLE t1 ref a a 4 test.t2.a 1
364
1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where; Using join buffer
338
365
explain select * from t1 where a=0 or a=2;
339
366
id select_type table type possible_keys key key_len ref rows Extra
340
367
1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where
341
368
explain select * from t1 force index (a) where a=0 or a=2;
342
369
id select_type table type possible_keys key key_len ref rows Extra
343
1 SIMPLE t1 range a a 4 NULL 4 Using where
370
1 SIMPLE t1 range a a 4 NULL 4 Using where; Using MRR
344
371
explain select * from t1 where c=1;
345
372
id select_type table type possible_keys key key_len ref rows Extra
346
1 SIMPLE t1 ref c,c_2 c 5 const 1 Using where
373
1 SIMPLE t1 ref c,c_2 c 5 const 1
347
374
explain select * from t1 use index() where c=1;
348
375
id select_type table type possible_keys key key_len ref rows Extra
349
376
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
350
377
drop table t1,t2;
351
create temporary table t1 (a int not null auto_increment primary key, b varchar(255)) engine=myisam;
378
create table t1 (a int not null auto_increment primary key, b varchar(255));
352
379
insert into t1 (b) values (repeat('a',100)),(repeat('b',100)),(repeat('c',100));
353
380
update t1 set b=repeat(left(b,1),200) where a=1;
354
381
delete from t1 where (a mod 2) = 0;
560
CREATE TEMPORARY TABLE t1 (
561
`_id` int NOT NULL default '0',
565
`loverlap` int default NULL,
566
`roverlap` int default NULL,
567
`lneighbor_id` int default NULL,
568
`rneighbor_id` int default NULL,
569
`length_` int default NULL,
572
`_obj_class` text NOT NULL,
574
UNIQUE KEY `sequence_name_index` (`name`(50)),
577
INSERT INTO t1 VALUES
578
(1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample1',''),
579
(2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample2',''),
580
(3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample3',''),
581
(4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample4',''),
582
(5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample5',''),
583
(6,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample6',''),
584
(7,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample7',''),
585
(8,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample8',''),
586
(9,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample9','');
598
DELETE FROM t1 WHERE _id < 8;
599
show table status LIKE 't1';
600
Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment
601
# test t1 TEMPORARY MyISAM # # # # #
603
Table Op Msg_type Msg_text
604
test.t1 check status OK
605
ALTER TABLE t1 ENGINE=MYISAM;
607
Table Op Msg_type Msg_text
608
test.t1 check status OK
609
show table status LIKE 't1';
610
Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment
611
# test t1 TEMPORARY MyISAM # # # # #
617
CREATE TEMPORARY TABLE t1 (c1 TEXT) ENGINE=MyISAM;
618
show table status like 't1';
619
Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment
620
# test t1 TEMPORARY MyISAM # # # # #
622
CREATE TEMPORARY TABLE t1 (c1 TEXT NOT NULL, KEY c1 (c1(10))) ENGINE=MyISAM;
621
CREATE TABLE t1(a CHAR(9), b VARCHAR(7)) ENGINE=MyISAM;
622
INSERT INTO t1(a) VALUES('xxxxxxxxx'),('xxxxxxxxx');
623
UPDATE t1 AS ta1,t1 AS ta2 SET ta1.b='aaaaaa',ta2.b='bbbbbb';
629
SET GLOBAL myisam_repair_threads=2;
630
SHOW VARIABLES LIKE 'myisam_repair%';
632
myisam_repair_threads 2
634
`_id` int NOT NULL default '0',
638
`loverlap` int default NULL,
639
`roverlap` int default NULL,
640
`lneighbor_id` int default NULL,
641
`rneighbor_id` int default NULL,
642
`length_` int default NULL,
645
`_obj_class` text NOT NULL,
647
UNIQUE KEY `sequence_name_index` (`name`(50)),
650
INSERT INTO t1 VALUES
651
(1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample1',''),
652
(2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample2',''),
653
(3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample3',''),
654
(4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample4',''),
655
(5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample5',''),
656
(6,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample6',''),
657
(7,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample7',''),
658
(8,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample8',''),
659
(9,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample9','');
671
DELETE FROM t1 WHERE _id < 8;
672
SHOW TABLE STATUS LIKE 't1';
673
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
674
t1 MyISAM 0 Dynamic 2 # # # # 168 # # # # # #
675
CHECK TABLE t1 EXTENDED;
676
Table Op Msg_type Msg_text
677
test.t1 check status OK
679
Table Op Msg_type Msg_text
680
test.t1 optimize status OK
681
CHECK TABLE t1 EXTENDED;
682
Table Op Msg_type Msg_text
683
test.t1 check status OK
684
SHOW TABLE STATUS LIKE 't1';
685
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
686
t1 MyISAM 0 Dynamic 2 # # # # 0 # # # # # #
693
`_id` int NOT NULL default '0',
697
`loverlap` int default NULL,
698
`roverlap` int default NULL,
699
`lneighbor_id` int default NULL,
700
`rneighbor_id` int default NULL,
701
`length_` int default NULL,
704
`_obj_class` text NOT NULL,
706
UNIQUE KEY `sequence_name_index` (`name`(50)),
709
INSERT INTO t1 VALUES
710
(1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample1',''),
711
(2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample2',''),
712
(3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample3',''),
713
(4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample4',''),
714
(5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample5',''),
715
(6,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample6',''),
716
(7,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample7',''),
717
(8,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample8',''),
718
(9,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample9','');
730
DELETE FROM t1 WHERE _id < 8;
731
SHOW TABLE STATUS LIKE 't1';
732
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
733
t1 MyISAM 0 Dynamic 2 # # # # 168 # # # # # #
734
CHECK TABLE t1 EXTENDED;
735
Table Op Msg_type Msg_text
736
test.t1 check status OK
737
REPAIR TABLE t1 QUICK;
738
Table Op Msg_type Msg_text
739
test.t1 repair status OK
740
CHECK TABLE t1 EXTENDED;
741
Table Op Msg_type Msg_text
742
test.t1 check status OK
743
SHOW TABLE STATUS LIKE 't1';
744
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
745
t1 MyISAM 0 Dynamic 2 # # # # 168 # # # # # #
751
SET GLOBAL myisam_repair_threads=1;
752
SHOW VARIABLES LIKE 'myisam_repair%';
754
myisam_repair_threads 1
755
CREATE TABLE t1(a VARCHAR(16)) ENGINE=MyISAM;
756
INSERT INTO t1 VALUES('aaaaaaaa'),(NULL);
757
UPDATE t1 AS ta1, t1 AS ta2 SET ta1.a='aaaaaaaaaaaaaaaa';
763
CREATE TABLE t1(a INT) ENGINE=MyISAM;
764
INSERT INTO t1 VALUES(1),(2);
765
UPDATE t1,t1 AS t2 SET t1.a=t1.a+2 WHERE t1.a=t2.a-1;
766
SELECT * FROM t1 ORDER BY a;
771
CREATE TABLE t1 (c1 TEXT) ENGINE=MyISAM AVG_ROW_LENGTH=70100 MAX_ROWS=4100100100;
772
SHOW TABLE STATUS LIKE 't1';
773
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
774
t1 MyISAM 0 Dynamic X X X 72057594037927935 X X X X X X utf8_general_ci X max_rows=4100100100 avg_row_length=70100
776
CREATE TABLE t1 (c1 TEXT NOT NULL, KEY c1 (c1(10))) ENGINE=MyISAM;
623
777
INSERT INTO t1 VALUES
624
778
(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
625
779
(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
774
928
drop table if exists t1,t2,t3;
775
929
--- Testing varchar ---
776
930
--- Testing varchar ---
777
create TEMPORARY table t1 (v varchar(10), c char(10), t text);
931
create table t1 (v varchar(10), c char(10), t text);
778
932
insert into t1 values('+ ', '+ ', '+ ');
779
933
set @a=repeat(' ',20);
780
934
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
781
ERROR 22001: Data too long for column 'v' at row 1
782
set @a=repeat(' ',10);
783
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
784
ERROR 22001: Data too long for column 'v' at row 1
785
set @a=repeat(' ',9);
786
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
936
Note 1265 Data truncated for column 'v' at row 1
937
Note 1265 Data truncated for column 'c' at row 1
787
938
select concat('*',v,'*',c,'*',t,'*') from t1;
788
939
concat('*',v,'*',c,'*',t,'*')
791
942
show create table t1;
792
943
Table Create Table
793
t1 CREATE TEMPORARY TABLE `t1` (
794
`v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
795
`c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
796
`t` TEXT COLLATE utf8_general_ci
797
) ENGINE=MyISAM COLLATE = utf8_general_ci
798
create TEMPORARY table t2 like t1;
944
t1 CREATE TABLE `t1` (
945
`v` varchar(10) DEFAULT NULL,
946
`c` varchar(10) DEFAULT NULL,
949
create table t2 like t1;
799
950
show create table t2;
800
951
Table Create Table
801
t2 CREATE TEMPORARY TABLE `t2` (
802
`v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
803
`c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
804
`t` TEXT COLLATE utf8_general_ci
805
) ENGINE=MyISAM COLLATE = utf8_general_ci
806
create TEMPORARY table t3 select * from t1;
952
t2 CREATE TABLE `t2` (
953
`v` varchar(10) DEFAULT NULL,
954
`c` varchar(10) DEFAULT NULL,
957
create table t3 select * from t1;
807
958
show create table t3;
808
959
Table Create Table
809
t3 CREATE TEMPORARY TABLE `t3` (
810
`v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
811
`c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
812
`t` TEXT COLLATE utf8_general_ci
813
) ENGINE=MyISAM COLLATE = utf8_general_ci
960
t3 CREATE TABLE `t3` (
961
`v` varchar(10) DEFAULT NULL,
962
`c` varchar(10) DEFAULT NULL,
814
965
alter table t1 modify c varchar(10);
815
966
show create table t1;
816
967
Table Create Table
817
t1 CREATE TEMPORARY TABLE `t1` (
818
`v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
819
`c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
820
`t` TEXT COLLATE utf8_general_ci
821
) ENGINE=MyISAM COLLATE = utf8_general_ci
968
t1 CREATE TABLE `t1` (
969
`v` varchar(10) DEFAULT NULL,
970
`c` varchar(10) DEFAULT NULL,
822
973
alter table t1 modify v char(10);
823
974
show create table t1;
824
975
Table Create Table
825
t1 CREATE TEMPORARY TABLE `t1` (
826
`v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
827
`c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
828
`t` TEXT COLLATE utf8_general_ci
829
) ENGINE=MyISAM COLLATE = utf8_general_ci
976
t1 CREATE TABLE `t1` (
977
`v` varchar(10) DEFAULT NULL,
978
`c` varchar(10) DEFAULT NULL,
830
981
alter table t1 modify t varchar(10);
983
Note 1265 Data truncated for column 't' at row 2
831
984
show create table t1;
832
985
Table Create Table
833
t1 CREATE TEMPORARY TABLE `t1` (
834
`v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
835
`c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
836
`t` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL
837
) ENGINE=MyISAM COLLATE = utf8_general_ci
986
t1 CREATE TABLE `t1` (
987
`v` varchar(10) DEFAULT NULL,
988
`c` varchar(10) DEFAULT NULL,
989
`t` varchar(10) DEFAULT NULL
838
991
select concat('*',v,'*',c,'*',t,'*') from t1;
839
992
concat('*',v,'*',c,'*',t,'*')
842
995
drop table t1,t2,t3;
843
create TEMPORARY table t1 (v varchar(10), c char(10), t text, key(v), key(c), key(t(10)));
996
create table t1 (v varchar(10), c char(10), t text, key(v), key(c), key(t(10)));
844
997
show create table t1;
845
998
Table Create Table
846
t1 CREATE TEMPORARY TABLE `t1` (
847
`v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
848
`c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
849
`t` TEXT COLLATE utf8_general_ci,
999
t1 CREATE TABLE `t1` (
1000
`v` varchar(10) DEFAULT NULL,
1001
`c` varchar(10) DEFAULT NULL,
853
) ENGINE=MyISAM COLLATE = utf8_general_ci
854
1007
select count(*) from t1;
1343
create temporary table t1 (v varchar(65530), key(v));
1344
ERROR 42000: Column length too big for column 'v' (max = 16383); use BLOB or TEXT instead
1345
create temporary table t1 (v varchar(65536));
1346
ERROR 42000: Column length too big for column 'v' (max = 16383); use BLOB or TEXT instead
1347
create temporary table t1 (v varchar(65530));
1348
ERROR 42000: Column length too big for column 'v' (max = 16383); use BLOB or TEXT instead
1349
create temporary table t1 (v varchar(65535));
1498
create table t1 (v varchar(65530), key(v));
1499
ERROR 42000: Column length too big for column 'v' (max = 16383); use BLOB or TEXT instead
1500
create table t1 (v varchar(65536));
1501
ERROR 42000: Column length too big for column 'v' (max = 16383); use BLOB or TEXT instead
1502
create table t1 (v varchar(65530));
1503
ERROR 42000: Column length too big for column 'v' (max = 16383); use BLOB or TEXT instead
1504
create table t1 (v varchar(65535));
1350
1505
ERROR 42000: Column length too big for column 'v' (max = 16383); use BLOB or TEXT instead
1351
1506
set storage_engine=InnoDB;
1352
create temporary table t1 (a int, key(a)) engine=myisam;
1507
create table t1 (a int, key(a));
1353
1508
insert into t1 values (1),(2),(3),(4),(NULL),(NULL),(NULL),(NULL);
1354
1509
analyze table t1;
1355
1510
Table Op Msg_type Msg_text
1356
test.t1 analyze note The storage engine for the table doesn't support analyze
1511
test.t1 analyze status OK
1357
1512
show keys from t1;
1358
Table Unique Key_name Seq_in_index Column_name
1513
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
1514
t1 1 a 1 a A 8 NULL NULL YES BTREE
1360
1515
alter table t1 disable keys;
1517
Note 1031 Table storage engine for 't1' doesn't have this option
1361
1518
alter table t1 enable keys;
1520
Note 1031 Table storage engine for 't1' doesn't have this option
1362
1521
show keys from t1;
1363
Table Unique Key_name Seq_in_index Column_name
1522
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
1523
t1 1 a 1 a A 8 NULL NULL YES BTREE
1366
CREATE TEMPORARY TABLE t1(a INT, b INT, KEY inx (a), UNIQUE KEY uinx (b)) ENGINE=MyISAM;
1525
create table t1 (c1 int) engine=myisam pack_keys=0;
1526
create table t2 (c1 int) engine=myisam pack_keys=1;
1527
create table t3 (c1 int) engine=myisam pack_keys=default;
1528
create table t4 (c1 int) engine=myisam pack_keys=2;
1529
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near '2' at line 1
1530
drop table t1, t2, t3;
1531
CREATE TABLE t1(a INT, b INT, KEY inx (a), UNIQUE KEY uinx (b)) ENGINE=MyISAM;
1367
1532
INSERT INTO t1(a,b) VALUES (1,1),(2,2),(3,3),(4,4),(5,5);
1368
1533
SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
1392
CREATE TEMPORARY TABLE t1 (c1 INT, c2 INT, UNIQUE INDEX (c1), INDEX (c2)) ENGINE=MYISAM;
1393
show table status like 't1';
1394
Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment
1395
# test t1 TEMPORARY MyISAM # # # # #
1557
CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE INDEX (c1), INDEX (c2)) ENGINE=MYISAM;
1558
SHOW TABLE STATUS LIKE 't1';
1559
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
1560
t1 MyISAM 0 Fixed 0 # # # 1024 # # # # # # #
1396
1561
INSERT INTO t1 VALUES (1,1);
1397
show table status like 't1';
1398
Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment
1399
# test t1 TEMPORARY MyISAM # # # # #
1400
ALTER TABLE t1 DISABLE KEYS;
1401
show table status like 't1';
1402
Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment
1403
# test t1 TEMPORARY MyISAM # # # # #
1404
ALTER TABLE t1 ENABLE KEYS;
1405
show table status like 't1';
1406
Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment
1407
# test t1 TEMPORARY MyISAM # # # # #
1408
ALTER TABLE t1 DISABLE KEYS;
1409
show table status like 't1';
1410
Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment
1411
# test t1 TEMPORARY MyISAM # # # # #
1412
ALTER TABLE t1 ENABLE KEYS;
1413
show table status like 't1';
1414
Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment
1415
# test t1 TEMPORARY MyISAM # # # # #
1562
SHOW TABLE STATUS LIKE 't1';
1563
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
1564
t1 MyISAM 0 Fixed 1 # # # 3072 # # # # # # #
1565
ALTER TABLE t1 DISABLE KEYS;
1566
SHOW TABLE STATUS LIKE 't1';
1567
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
1568
t1 MyISAM 0 Fixed 1 # # # 3072 # # # # # # #
1569
ALTER TABLE t1 ENABLE KEYS;
1570
SHOW TABLE STATUS LIKE 't1';
1571
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
1572
t1 MyISAM 0 Fixed 1 # # # 3072 # # # # # # #
1573
ALTER TABLE t1 DISABLE KEYS;
1574
SHOW TABLE STATUS LIKE 't1';
1575
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
1576
t1 MyISAM 0 Fixed 1 # # # 3072 # # # # # # #
1577
ALTER TABLE t1 ENABLE KEYS;
1578
SHOW TABLE STATUS LIKE 't1';
1579
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
1580
t1 MyISAM 0 Fixed 1 # # # 3072 # # # # # # #
1416
1581
# Enable keys with parallel repair
1582
SET GLOBAL myisam_repair_threads=2;
1417
1583
ALTER TABLE t1 DISABLE KEYS;
1418
1584
ALTER TABLE t1 ENABLE KEYS;
1585
SET GLOBAL myisam_repair_threads=1;
1586
CHECK TABLE t1 EXTENDED;
1420
1587
Table Op Msg_type Msg_text
1421
1588
test.t1 check status OK
1423
CREATE TABLE t1 (id int NOT NULL, ref int NOT NULL, INDEX (id));
1590
CREATE TABLE t1 (id int NOT NULL, ref int NOT NULL, INDEX (id)) ENGINE=MyISAM;
1424
1591
CREATE TABLE t2 LIKE t1;
1425
1592
INSERT INTO t2 (id, ref) VALUES (1,3), (2,1), (3,2), (4,5), (4,4);
1426
1593
INSERT INTO t1 SELECT * FROM t2;
1604
DELETE FROM a USING t1 AS a INNER JOIN t1 AS b USING (id) WHERE a.ref < b.ref;
1437
1611
DROP TABLE t1, t2;
1438
1612
End of 5.0 tests
1439
CREATE temporary TABLE t1 (
1613
create table t1 (a int not null, key `a` (a) key_block_size=1024) ENGINE=MyISAM;
1614
show create table t1;
1616
t1 CREATE TABLE `t1` (
1618
KEY `a` (`a`) KEY_BLOCK_SIZE=1024
1621
create table t1 (a int not null, key `a` (a) key_block_size=2048) ENGINE=MyISAM;
1622
show create table t1;
1624
t1 CREATE TABLE `t1` (
1626
KEY `a` (`a`) KEY_BLOCK_SIZE=2048
1629
create table t1 (a varchar(2048), key `a` (a)) ENGINE=MyISAM;
1631
Warning 1071 Specified key was too long; max key length is 1332 bytes
1632
show create table t1;
1634
t1 CREATE TABLE `t1` (
1635
`a` varchar(2048) DEFAULT NULL,
1639
create table t1 (a varchar(2048), key `a` (a) key_block_size=1024) ENGINE=MyISAM;
1641
Warning 1071 Specified key was too long; max key length is 1332 bytes
1642
show create table t1;
1644
t1 CREATE TABLE `t1` (
1645
`a` varchar(2048) DEFAULT NULL,
1646
KEY `a` (`a`()) KEY_BLOCK_SIZE=6144
1649
create table t1 (a int not null, b varchar(2048), key (a), key(b)) ENGINE=MyISAM key_block_size=1024;
1651
Warning 1071 Specified key was too long; max key length is 1332 bytes
1652
show create table t1;
1654
t1 CREATE TABLE `t1` (
1656
`b` varchar(2048) DEFAULT NULL,
1658
KEY `b` (`b`()) KEY_BLOCK_SIZE=6144
1659
) ENGINE=MyISAM KEY_BLOCK_SIZE=1024
1660
alter table t1 key_block_size=2048;
1661
show create table t1;
1663
t1 CREATE TABLE `t1` (
1665
`b` varchar(2048) DEFAULT NULL,
1666
KEY `a` (`a`) KEY_BLOCK_SIZE=1024,
1667
KEY `b` (`b`()) KEY_BLOCK_SIZE=8192
1668
) ENGINE=MyISAM KEY_BLOCK_SIZE=2048
1669
alter table t1 add c int, add key (c);
1670
show create table t1;
1672
t1 CREATE TABLE `t1` (
1674
`b` varchar(2048) DEFAULT NULL,
1675
`c` int DEFAULT NULL,
1676
KEY `a` (`a`) KEY_BLOCK_SIZE=1024,
1677
KEY `b` (`b`()) KEY_BLOCK_SIZE=8192,
1679
) ENGINE=MyISAM KEY_BLOCK_SIZE=2048
1680
alter table t1 key_block_size=0;
1681
alter table t1 add d int, add key (d);
1682
show create table t1;
1684
t1 CREATE TABLE `t1` (
1686
`b` varchar(2048) DEFAULT NULL,
1687
`c` int DEFAULT NULL,
1688
`d` int DEFAULT NULL,
1689
KEY `a` (`a`) KEY_BLOCK_SIZE=1024,
1690
KEY `b` (`b`()) KEY_BLOCK_SIZE=8192,
1691
KEY `c` (`c`) KEY_BLOCK_SIZE=2048,
1695
create table t1 (a int not null, b varchar(2048), key (a), key(b)) ENGINE=MyISAM key_block_size=8192;
1697
Warning 1071 Specified key was too long; max key length is 1332 bytes
1698
show create table t1;
1700
t1 CREATE TABLE `t1` (
1702
`b` varchar(2048) DEFAULT NULL,
1705
) ENGINE=MyISAM KEY_BLOCK_SIZE=8192
1707
create table t1 (a int not null, b varchar(2048), key (a) key_block_size=1024, key(b)) ENGINE=MyISAM key_block_size=8192;
1709
Warning 1071 Specified key was too long; max key length is 1332 bytes
1710
show create table t1;
1712
t1 CREATE TABLE `t1` (
1714
`b` varchar(2048) DEFAULT NULL,
1715
KEY `a` (`a`) KEY_BLOCK_SIZE=1024,
1717
) ENGINE=MyISAM KEY_BLOCK_SIZE=8192
1719
create table t1 (a int not null, b int, key (a) key_block_size=1024, key(b) key_block_size=8192) ENGINE=MyISAM key_block_size=16384;
1720
show create table t1;
1722
t1 CREATE TABLE `t1` (
1724
`b` int DEFAULT NULL,
1725
KEY `a` (`a`) KEY_BLOCK_SIZE=1024,
1726
KEY `b` (`b`) KEY_BLOCK_SIZE=8192
1727
) ENGINE=MyISAM KEY_BLOCK_SIZE=16384
1729
create table t1 (a int not null, key `a` (a) key_block_size=512) ENGINE=MyISAM;
1730
show create table t1;
1732
t1 CREATE TABLE `t1` (
1734
KEY `a` (`a`) KEY_BLOCK_SIZE=1024
1737
create table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000) ENGINE=MyISAM;
1739
Warning 1071 Specified key was too long; max key length is 1332 bytes
1740
show create table t1;
1742
t1 CREATE TABLE `t1` (
1743
`a` varchar(2048) DEFAULT NULL,
1744
KEY `a` (`a`()) KEY_BLOCK_SIZE=6144
1747
create table t1 (a int not null, key `a` (a) key_block_size=1025) ENGINE=MyISAM;
1748
show create table t1;
1750
t1 CREATE TABLE `t1` (
1752
KEY `a` (`a`) KEY_BLOCK_SIZE=2048
1755
create table t1 (a int not null, key key_block_size=1024 (a)) ENGINE=MyISAM;
1756
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near '=1024 (a)) ENGINE=MyISAM' at line 1
1757
create table t1 (a int not null, key `a` key_block_size=1024 (a)) ENGINE=MyISAM;
1758
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'key_block_size=1024 (a)) ENGINE=MyISAM' at line 1
1441
1761
c2 VARCHAR(300),
1442
1762
KEY (c1) KEY_BLOCK_SIZE 1024,