| 1 |
SET @old_innodb_file_per_table = @@innodb_file_per_table; |
| 2 |
SET GLOBAL innodb_file_per_table = 1; |
| 3 |
SELECT @@innodb_file_per_table; |
| 4 |
@@innodb_file_per_table |
| 5 |
1 |
| 6 |
CREATE TABLE t1 ( |
| 7 |
col_1 CHAR (255), |
| 8 |
col_2 VARCHAR (255) |
| 9 |
) ENGINE = InnoDB charset latin1; |
| 10 |
CREATE INDEX idx1 ON t1(col_1); |
| 11 |
CREATE INDEX idx2 ON t1(col_2); |
| 12 |
ANALYZE TABLE t1; |
| 13 |
Table Op Msg_type Msg_text |
| 14 |
test.t1 analyze status OK |
| 15 |
SHOW INDEXES FROM t1; |
| 16 |
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Visible Expression |
| 17 |
t1 1 idx1 1 col_1 A 0 NULL NULL YES BTREE YES NULL |
| 18 |
t1 1 idx2 1 col_2 A 0 NULL NULL YES BTREE YES NULL |
| 19 |
INSERT INTO t1 VALUES ("col1_00001", "col2_00001"), ("col1_00002", "col2_00002"); |
| 20 |
ANALYZE TABLE t1; |
| 21 |
Table Op Msg_type Msg_text |
| 22 |
test.t1 analyze status OK |
| 23 |
SHOW INDEXES FROM t1; |
| 24 |
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Visible Expression |
| 25 |
t1 1 idx1 1 col_1 A 2 NULL NULL YES BTREE YES NULL |
| 26 |
t1 1 idx2 1 col_2 A 2 NULL NULL YES BTREE YES NULL |
| 27 |
ANALYZE TABLE t1; |
| 28 |
Table Op Msg_type Msg_text |
| 29 |
test.t1 analyze status OK |
| 30 |
SHOW INDEXES FROM t1; |
| 31 |
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Visible Expression |
| 32 |
t1 1 idx1 1 col_1 A 2 NULL NULL YES BTREE YES NULL |
| 33 |
t1 1 idx2 1 col_2 A 2 NULL NULL YES BTREE YES NULL |
| 34 |
FLUSH TABLES t1 FOR EXPORT; |
| 35 |
backup: t1 |
| 36 |
UNLOCK TABLES; |
| 37 |
DROP TABLE t1; |
| 38 |
CREATE TABLE t1 ( |
| 39 |
col_1 CHAR (255), |
| 40 |
col_2 VARCHAR (255) |
| 41 |
) ENGINE = InnoDB charset latin1; |
| 42 |
CREATE INDEX idx1 ON t1(col_1); |
| 43 |
CREATE INDEX idx2 ON t1(col_2); |
| 44 |
ANALYZE TABLE t1; |
| 45 |
Table Op Msg_type Msg_text |
| 46 |
test.t1 analyze status OK |
| 47 |
SHOW INDEXES FROM t1; |
| 48 |
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Visible Expression |
| 49 |
t1 1 idx1 1 col_1 A 0 NULL NULL YES BTREE YES NULL |
| 50 |
t1 1 idx2 1 col_2 A 0 NULL NULL YES BTREE YES NULL |
| 51 |
INSERT INTO t1 VALUES ("col1_00001", "col2_00001"); |
| 52 |
ANALYZE TABLE t1; |
| 53 |
Table Op Msg_type Msg_text |
| 54 |
test.t1 analyze status OK |
| 55 |
SHOW INDEXES FROM t1; |
| 56 |
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Visible Expression |
| 57 |
t1 1 idx1 1 col_1 A 1 NULL NULL YES BTREE YES NULL |
| 58 |
t1 1 idx2 1 col_2 A 1 NULL NULL YES BTREE YES NULL |
| 59 |
ANALYZE TABLE t1; |
| 60 |
Table Op Msg_type Msg_text |
| 61 |
test.t1 analyze status OK |
| 62 |
SHOW INDEXES FROM t1; |
| 63 |
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Visible Expression |
| 64 |
t1 1 idx1 1 col_1 A 1 NULL NULL YES BTREE YES NULL |
| 65 |
t1 1 idx2 1 col_2 A 1 NULL NULL YES BTREE YES NULL |
| 66 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 67 |
restore: t1 .ibd and .cfg files |
| 68 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 69 |
ANALYZE TABLE t1; |
| 70 |
Table Op Msg_type Msg_text |
| 71 |
test.t1 analyze status OK |
| 72 |
SHOW INDEXES FROM t1; |
| 73 |
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Visible Expression |
| 74 |
t1 1 idx1 1 col_1 A 2 NULL NULL YES BTREE YES NULL |
| 75 |
t1 1 idx2 1 col_2 A 2 NULL NULL YES BTREE YES NULL |
| 76 |
ANALYZE TABLE t1; |
| 77 |
Table Op Msg_type Msg_text |
| 78 |
test.t1 analyze status OK |
| 79 |
SHOW INDEXES FROM t1; |
| 80 |
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Visible Expression |
| 81 |
t1 1 idx1 1 col_1 A 2 NULL NULL YES BTREE YES NULL |
| 82 |
t1 1 idx2 1 col_2 A 2 NULL NULL YES BTREE YES NULL |
| 83 |
DROP TABLE t1; |
| 84 |
SET GLOBAL innodb_file_per_table = @old_innodb_file_per_table; |