119 lines
5.0 KiB
Plaintext
119 lines
5.0 KiB
Plaintext
CREATE TABLE tab
|
|
(col1 TEXT, col2 TEXT, col3 TEXT, col4 TEXT, col5 TEXT,
|
|
col6 TEXT, col7 TEXT, col8 TEXT, col9 TEXT, col10 TEXT,
|
|
col11 TEXT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
|
=== information_schema.innodb_tables and innodb_tablespaces ===
|
|
Table Name Tablespace Table Flags Columns Row Format Zip Size Space Type
|
|
mtr/global_suppressions mtr/global_suppressions 33 7 Dynamic 0 Single
|
|
mtr/test_suppressions mtr/test_suppressions 33 7 Dynamic 0 Single
|
|
test/tab test/tab 33 17 Dynamic 0 Single
|
|
INSERT INTO tab SET
|
|
col1=REPEAT('a',1000),col2=REPEAT('b',1000),col3=REPEAT('c',1000),
|
|
col4=REPEAT('d',1000),col5=REPEAT('e',1000),col6=REPEAT('f',1000),
|
|
col7=REPEAT('g',1000),col8=REPEAT('h',1000),col9=REPEAT('i',1000),
|
|
col10=REPEAT('j',1000),col11=REPEAT('k',1000);
|
|
INSERT INTO tab SELECT * FROM tab;
|
|
ALTER TABLE tab ROW_FORMAT=COMPACT;
|
|
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
|
|
DROP TABLE tab;
|
|
# ###########################################################
|
|
# Check with Import/Export tablespace with Default_row_format
|
|
SET GLOBAL innodb_default_row_format=Compact;
|
|
SELECT @@innodb_default_row_format;
|
|
@@innodb_default_row_format
|
|
compact
|
|
SELECT @@innodb_file_per_table;
|
|
@@innodb_file_per_table
|
|
1
|
|
CREATE TABLE tab(a INT);
|
|
INSERT INTO tab VALUES(1);
|
|
INSERT INTO tab VALUES(2);
|
|
SELECT * FROM tab;
|
|
a
|
|
1
|
|
2
|
|
FLUSH TABLE tab FOR EXPORT;
|
|
UNLOCK TABLES;
|
|
DROP TABLE tab;
|
|
SET GLOBAL innodb_default_row_format=Dynamic;
|
|
CREATE TABLE tab(a INT);
|
|
ALTER TABLE tab DISCARD TABLESPACE;
|
|
ALTER TABLE tab IMPORT TABLESPACE;
|
|
ERROR HY000: Schema mismatch (Table flags don't match, server table has ROW_TYPE_DYNAMIC and the meta-data file has ROW_TYPE_COMPACT)
|
|
DROP TABLE tab;
|
|
SET GLOBAL innodb_default_row_format=Compact;
|
|
SELECT @@innodb_default_row_format;
|
|
@@innodb_default_row_format
|
|
compact
|
|
CREATE TABLE tab(a INT);
|
|
=== information_schema.innodb_tables and innodb_tablespaces ===
|
|
Table Name Tablespace Table Flags Columns Row Format Zip Size Space Type
|
|
mtr/global_suppressions mtr/global_suppressions 33 7 Dynamic 0 Single
|
|
mtr/test_suppressions mtr/test_suppressions 33 7 Dynamic 0 Single
|
|
test/tab test/tab 1 7 Compact 0 Single
|
|
ALTER TABLE tab DISCARD TABLESPACE;
|
|
ALTER TABLE tab IMPORT TABLESPACE;
|
|
SELECT * FROM tab;
|
|
a
|
|
1
|
|
2
|
|
DROP TABLE tab;
|
|
# ###########################################################
|
|
SET GLOBAL innodb_default_row_format=Dynamic;
|
|
SELECT @@innodb_default_row_format;
|
|
@@innodb_default_row_format
|
|
dynamic
|
|
CREATE TABLE tab(a INT PRIMARY KEY, b VARCHAR(5000), KEY idx1(b(3070))) ENGINE= InnoDB charset latin1;
|
|
INSERT INTO tab(a,b) VALUES(1,'Check with max column size');
|
|
SELECT * FROM tab;
|
|
a b
|
|
1 Check with max column size
|
|
=== information_schema.innodb_tables and innodb_tablespaces ===
|
|
Table Name Tablespace Table Flags Columns Row Format Zip Size Space Type
|
|
mtr/global_suppressions mtr/global_suppressions 33 7 Dynamic 0 Single
|
|
mtr/test_suppressions mtr/test_suppressions 33 7 Dynamic 0 Single
|
|
test/tab test/tab 33 8 Dynamic 0 Single
|
|
SET GLOBAL innodb_default_row_format=COMPACT;
|
|
ALTER TABLE tab ROW_FORMAT=COMPACT;
|
|
ERROR 42000: Specified key was too long; max key length is 767 bytes
|
|
DROP TABLE tab;
|
|
SET GLOBAL innodb_default_row_format=Default;
|
|
SELECT @@innodb_default_row_format;
|
|
@@innodb_default_row_format
|
|
dynamic
|
|
CREATE TABLE tab(a INT PRIMARY KEY, b VARCHAR(5000), KEY idx1(b(767))) ENGINE= InnoDB charset latin1;
|
|
INSERT INTO tab(a,b) VALUES(1,'Check with max column size');
|
|
SELECT * FROM tab;
|
|
a b
|
|
1 Check with max column size
|
|
=== information_schema.innodb_tables and innodb_tablespaces ===
|
|
Table Name Tablespace Table Flags Columns Row Format Zip Size Space Type
|
|
mtr/global_suppressions mtr/global_suppressions 33 7 Dynamic 0 Single
|
|
mtr/test_suppressions mtr/test_suppressions 33 7 Dynamic 0 Single
|
|
test/tab test/tab 33 8 Dynamic 0 Single
|
|
ALTER TABLE tab ROW_FORMAT=COMPACT;
|
|
=== information_schema.innodb_tables and innodb_tablespaces ===
|
|
Table Name Tablespace Table Flags Columns Row Format Zip Size Space Type
|
|
mtr/global_suppressions mtr/global_suppressions 33 7 Dynamic 0 Single
|
|
mtr/test_suppressions mtr/test_suppressions 33 7 Dynamic 0 Single
|
|
test/tab test/tab 1 8 Compact 0 Single
|
|
SELECT * FROM tab;
|
|
a b
|
|
1 Check with max column size
|
|
ALTER TABLE tab ROW_FORMAT=COMPRESSED;
|
|
=== information_schema.innodb_tables and innodb_tablespaces ===
|
|
Table Name Tablespace Table Flags Columns Row Format Zip Size Space Type
|
|
mtr/global_suppressions mtr/global_suppressions 33 7 Dynamic 0 Single
|
|
mtr/test_suppressions mtr/test_suppressions 33 7 Dynamic 0 Single
|
|
test/tab test/tab 41 8 Compressed 8192 Single
|
|
SELECT * FROM tab;
|
|
a b
|
|
1 Check with max column size
|
|
ALTER TABLE tab ROW_FORMAT=Dynamic;
|
|
=== information_schema.innodb_tables and innodb_tablespaces ===
|
|
Table Name Tablespace Table Flags Columns Row Format Zip Size Space Type
|
|
mtr/global_suppressions mtr/global_suppressions 33 7 Dynamic 0 Single
|
|
mtr/test_suppressions mtr/test_suppressions 33 7 Dynamic 0 Single
|
|
test/tab test/tab 33 8 Dynamic 0 Single
|
|
DROP TABLE tab;
|