@@ -184,8 +184,8 @@ t1 CREATE TABLE `t1` (
184
184
`a` blob DEFAULT NULL,
185
185
`c` int(11) DEFAULT NULL,
186
186
`db_row_hash_1` int(11) DEFAULT NULL,
187
- UNIQUE KEY `a ` (`a`) USING HASH ,
188
- UNIQUE KEY `db_row_hash_1 ` (`db_row_hash_1`)
187
+ UNIQUE KEY `db_row_hash_1 ` (`db_row_hash_1`) ,
188
+ UNIQUE KEY `a ` (`a`) USING HASH
189
189
) ENGINE=MyISAM DEFAULT CHARSET=latin1
190
190
insert into t1 values(45,1,55),(46,1,55);
191
191
ERROR 23000: Duplicate entry '55' for key 'db_row_hash_1'
@@ -507,13 +507,13 @@ t1 CREATE TABLE `t1` (
507
507
`db_row_hash_1` int(11) DEFAULT NULL,
508
508
`db_row_hash_2` int(11) DEFAULT NULL,
509
509
`db_row_hash_3` int(11) DEFAULT NULL,
510
+ UNIQUE KEY `db_row_hash_1` (`db_row_hash_1`),
511
+ UNIQUE KEY `db_row_hash_2` (`db_row_hash_2`),
512
+ UNIQUE KEY `db_row_hash_3` (`db_row_hash_3`),
510
513
UNIQUE KEY `a` (`a`) USING HASH,
511
514
UNIQUE KEY `c` (`c`) USING HASH,
512
515
UNIQUE KEY `d` (`d`) USING HASH,
513
- UNIQUE KEY `e` (`e`) USING HASH,
514
- UNIQUE KEY `db_row_hash_1` (`db_row_hash_1`),
515
- UNIQUE KEY `db_row_hash_2` (`db_row_hash_2`),
516
- UNIQUE KEY `db_row_hash_3` (`db_row_hash_3`)
516
+ UNIQUE KEY `e` (`e`) USING HASH
517
517
) ENGINE=MyISAM DEFAULT CHARSET=latin1
518
518
alter table t1 add column db_row_hash_7 int, add column db_row_hash_5 int , add column db_row_hash_4 int ;
519
519
alter table t1 drop column db_row_hash_7,drop column db_row_hash_3, drop column db_row_hash_4;
@@ -543,17 +543,17 @@ t1 CREATE TABLE `t1` (
543
543
`db_row_hash_1` int(11) DEFAULT NULL,
544
544
`db_row_hash_2` int(11) DEFAULT NULL,
545
545
`db_row_hash_5` int(11) DEFAULT NULL,
546
- UNIQUE KEY `d` (`d`) USING HASH,
547
- UNIQUE KEY `e` (`e`) USING HASH,
548
546
UNIQUE KEY `db_row_hash_1` (`db_row_hash_1`),
549
- UNIQUE KEY `db_row_hash_2` (`db_row_hash_2`)
547
+ UNIQUE KEY `db_row_hash_2` (`db_row_hash_2`),
548
+ UNIQUE KEY `d` (`d`) USING HASH,
549
+ UNIQUE KEY `e` (`e`) USING HASH
550
550
) ENGINE=MyISAM DEFAULT CHARSET=latin1
551
551
show keys from t1;
552
552
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
553
- t1 0 d 1 d A NULL NULL NULL YES HASH
554
- t1 0 e 1 e A NULL NULL NULL YES HASH
555
553
t1 0 db_row_hash_1 1 db_row_hash_1 A NULL NULL NULL YES BTREE
556
554
t1 0 db_row_hash_2 1 db_row_hash_2 A NULL NULL NULL YES BTREE
555
+ t1 0 d 1 d A NULL NULL NULL YES HASH
556
+ t1 0 e 1 e A NULL NULL NULL YES HASH
557
557
#add column with unique index on blob;
558
558
alter table t1 add column a blob unique;
559
559
show create table t1;
@@ -567,18 +567,18 @@ t1 CREATE TABLE `t1` (
567
567
`db_row_hash_2` int(11) DEFAULT NULL,
568
568
`db_row_hash_5` int(11) DEFAULT NULL,
569
569
`a` blob DEFAULT NULL,
570
- UNIQUE KEY `d` (`d`) USING HASH,
571
- UNIQUE KEY `e` (`e`) USING HASH,
572
570
UNIQUE KEY `db_row_hash_1` (`db_row_hash_1`),
573
571
UNIQUE KEY `db_row_hash_2` (`db_row_hash_2`),
572
+ UNIQUE KEY `d` (`d`) USING HASH,
573
+ UNIQUE KEY `e` (`e`) USING HASH,
574
574
UNIQUE KEY `a` (`a`) USING HASH
575
575
) ENGINE=MyISAM DEFAULT CHARSET=latin1
576
576
show keys from t1;
577
577
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
578
- t1 0 d 1 d A NULL NULL NULL YES HASH
579
- t1 0 e 1 e A NULL NULL NULL YES HASH
580
578
t1 0 db_row_hash_1 1 db_row_hash_1 A NULL NULL NULL YES BTREE
581
579
t1 0 db_row_hash_2 1 db_row_hash_2 A NULL NULL NULL YES BTREE
580
+ t1 0 d 1 d A NULL NULL NULL YES HASH
581
+ t1 0 e 1 e A NULL NULL NULL YES HASH
582
582
t1 0 a 1 a A NULL NULL NULL YES HASH
583
583
#try to change the blob unique column name;
584
584
#this will change index to b tree;
@@ -594,19 +594,19 @@ t1 CREATE TABLE `t1` (
594
594
`db_row_hash_2` int(11) DEFAULT NULL,
595
595
`db_row_hash_5` int(11) DEFAULT NULL,
596
596
`a` int(11) DEFAULT NULL,
597
- UNIQUE KEY `d` (`d`) USING HASH,
598
- UNIQUE KEY `e` (`e`),
599
597
UNIQUE KEY `db_row_hash_1` (`db_row_hash_1`),
600
598
UNIQUE KEY `db_row_hash_2` (`db_row_hash_2`),
601
- UNIQUE KEY `a` (`a`)
599
+ UNIQUE KEY `e` (`e`),
600
+ UNIQUE KEY `a` (`a`),
601
+ UNIQUE KEY `d` (`d`) USING HASH
602
602
) ENGINE=MyISAM DEFAULT CHARSET=latin1
603
603
show keys from t1;
604
604
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
605
- t1 0 d 1 d A NULL NULL NULL YES HASH
606
- t1 0 e 1 e A NULL NULL NULL YES BTREE
607
605
t1 0 db_row_hash_1 1 db_row_hash_1 A NULL NULL NULL YES BTREE
608
606
t1 0 db_row_hash_2 1 db_row_hash_2 A NULL NULL NULL YES BTREE
607
+ t1 0 e 1 e A NULL NULL NULL YES BTREE
609
608
t1 0 a 1 a A NULL NULL NULL YES BTREE
609
+ t1 0 d 1 d A NULL NULL NULL YES HASH
610
610
alter table t1 add column clm1 blob unique,add column clm2 blob unique;
611
611
#try changing the name;
612
612
alter table t1 change column clm1 clm_changed1 blob, change column clm2 clm_changed2 blob;
@@ -623,21 +623,21 @@ t1 CREATE TABLE `t1` (
623
623
`a` int(11) DEFAULT NULL,
624
624
`clm_changed1` blob DEFAULT NULL,
625
625
`clm_changed2` blob DEFAULT NULL,
626
- UNIQUE KEY `d` (`d`) USING HASH,
627
- UNIQUE KEY `e` (`e`),
628
626
UNIQUE KEY `db_row_hash_1` (`db_row_hash_1`),
629
627
UNIQUE KEY `db_row_hash_2` (`db_row_hash_2`),
628
+ UNIQUE KEY `e` (`e`),
630
629
UNIQUE KEY `a` (`a`),
630
+ UNIQUE KEY `d` (`d`) USING HASH,
631
631
UNIQUE KEY `clm1` (`clm_changed1`) USING HASH,
632
632
UNIQUE KEY `clm2` (`clm_changed2`) USING HASH
633
633
) ENGINE=MyISAM DEFAULT CHARSET=latin1
634
634
show keys from t1;
635
635
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
636
- t1 0 d 1 d A NULL NULL NULL YES HASH
637
- t1 0 e 1 e A NULL NULL NULL YES BTREE
638
636
t1 0 db_row_hash_1 1 db_row_hash_1 A NULL NULL NULL YES BTREE
639
637
t1 0 db_row_hash_2 1 db_row_hash_2 A NULL NULL NULL YES BTREE
638
+ t1 0 e 1 e A NULL NULL NULL YES BTREE
640
639
t1 0 a 1 a A NULL NULL NULL YES BTREE
640
+ t1 0 d 1 d A NULL NULL NULL YES HASH
641
641
t1 0 clm1 1 clm_changed1 A NULL NULL NULL YES HASH
642
642
t1 0 clm2 1 clm_changed2 A NULL NULL NULL YES HASH
643
643
#now drop the unique key;
@@ -655,19 +655,19 @@ t1 CREATE TABLE `t1` (
655
655
`a` int(11) DEFAULT NULL,
656
656
`clm_changed1` blob DEFAULT NULL,
657
657
`clm_changed2` blob DEFAULT NULL,
658
- UNIQUE KEY `d` (`d`) USING HASH,
659
- UNIQUE KEY `e` (`e`),
660
658
UNIQUE KEY `db_row_hash_1` (`db_row_hash_1`),
661
659
UNIQUE KEY `db_row_hash_2` (`db_row_hash_2`),
662
- UNIQUE KEY `a` (`a`)
660
+ UNIQUE KEY `e` (`e`),
661
+ UNIQUE KEY `a` (`a`),
662
+ UNIQUE KEY `d` (`d`) USING HASH
663
663
) ENGINE=MyISAM DEFAULT CHARSET=latin1
664
664
show keys from t1;
665
665
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
666
- t1 0 d 1 d A NULL NULL NULL YES HASH
667
- t1 0 e 1 e A NULL NULL NULL YES BTREE
668
666
t1 0 db_row_hash_1 1 db_row_hash_1 A NULL NULL NULL YES BTREE
669
667
t1 0 db_row_hash_2 1 db_row_hash_2 A NULL NULL NULL YES BTREE
668
+ t1 0 e 1 e A NULL NULL NULL YES BTREE
670
669
t1 0 a 1 a A NULL NULL NULL YES BTREE
670
+ t1 0 d 1 d A NULL NULL NULL YES HASH
671
671
drop table t1;
672
672
#now the table with key on multiple columns; the ultimate test;
673
673
create table t1(a blob, b int , c varchar(2000) , d text , e varchar(3000) , f longblob , g int , h text ,
@@ -1130,17 +1130,17 @@ t1 CREATE TABLE `t1` (
1130
1130
`c` blob DEFAULT NULL,
1131
1131
`d` blob DEFAULT NULL,
1132
1132
`e` int(11) DEFAULT NULL,
1133
+ UNIQUE KEY `e` (`e`),
1133
1134
UNIQUE KEY `a` (`a`,`c`) USING HASH,
1134
- UNIQUE KEY `b` (`b`,`d`) USING HASH,
1135
- UNIQUE KEY `e` (`e`)
1135
+ UNIQUE KEY `b` (`b`,`d`) USING HASH
1136
1136
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1137
1137
show keys from t1;
1138
1138
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
1139
+ t1 0 e 1 e A NULL NULL NULL YES BTREE
1139
1140
t1 0 a 1 a A NULL NULL NULL YES HASH
1140
1141
t1 0 a 2 c A NULL NULL NULL YES HASH
1141
1142
t1 0 b 1 b A NULL NULL NULL YES HASH
1142
1143
t1 0 b 2 d A NULL NULL NULL YES HASH
1143
- t1 0 e 1 e A 0 NULL NULL YES BTREE
1144
1144
drop table t1;
1145
1145
#visibility of db_row_hash
1146
1146
create table t1 (a blob unique , b blob unique);
0 commit comments