| 1 |
DROP TABLE IF EXISTS t1; |
| 2 |
CREATE TABLE t1 (a <INT_COLUMN>, <CUSTOM_INDEX>(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; |
| 3 |
INSERT INTO t1 (a) VALUES (10); |
| 4 |
INSERT INTO t1 (a) VALUES |
| 5 |
(1),(2),(3),(4),(5),(6),(7),(8),(9), |
| 6 |
(21),(22),(23),(24),(25),(26),(27),(28),(29); |
| 7 |
EXPLAIN SELECT a FROM t1 ORDER BY a; |
| 8 |
id select_type table type possible_keys key key_len ref rows Extra |
| 9 |
1 SIMPLE t1 index NULL a 5 NULL # Using index |
| 10 |
SHOW INDEX IN t1; |
| 11 |
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
| 12 |
t1 1 a 1 a # # NULL NULL YES BTREE |
| 13 |
ALTER TABLE t1 DISABLE KEYS; |
| 14 |
SHOW INDEX IN t1; |
| 15 |
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
| 16 |
t1 1 a 1 a # # NULL NULL YES BTREE disabled |
| 17 |
EXPLAIN SELECT a FROM t1 ORDER BY a; |
| 18 |
id select_type table type possible_keys key key_len ref rows Extra |
| 19 |
1 SIMPLE t1 ALL NULL NULL NULL NULL 19 Using filesort |
| 20 |
INSERT INTO t1 (a) VALUES |
| 21 |
(11),(12),(13),(14),(15),(16),(17),(18),(19),(20); |
| 22 |
ALTER TABLE t1 ENABLE KEYS; |
| 23 |
SHOW INDEX IN t1; |
| 24 |
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
| 25 |
t1 1 a 1 a # # NULL NULL YES BTREE |
| 26 |
EXPLAIN SELECT a FROM t1 ORDER BY a; |
| 27 |
id select_type table type possible_keys key key_len ref rows Extra |
| 28 |
1 SIMPLE t1 index NULL a 5 NULL # Using index |
| 29 |
DROP TABLE t1; |
| 30 |
CREATE TABLE t1 (a <INT_COLUMN>, UNIQUE INDEX(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; |
| 31 |
INSERT INTO t1 (a) VALUES |
| 32 |
(1),(2),(3),(4),(5),(6),(7),(8),(9), |
| 33 |
(21),(22),(23),(24),(25),(26),(27),(28),(29); |
| 34 |
ALTER TABLE t1 DISABLE KEYS; |
| 35 |
INSERT INTO t1 (a) VALUES (29); |
| 36 |
ERROR 23000: Duplicate entry '29' for key 'a' |
| 37 |
# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY). |
| 38 |
# If you got a difference in error message, just add it to rdiff file |
| 39 |
SHOW INDEX IN t1; |
| 40 |
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
| 41 |
t1 0 a 1 a # # NULL NULL YES BTREE |
| 42 |
EXPLAIN SELECT a FROM t1 ORDER BY a; |
| 43 |
id select_type table type possible_keys key key_len ref rows Extra |
| 44 |
1 SIMPLE t1 index NULL a 5 NULL # Using index |
| 45 |
DROP TABLE t1; |