mirror of
https://github.com/MariaDB/server.git
synced 2025-12-06 05:42:06 +03:00
InnoDB in Debian uses utf8mb4 as default character set since version 10.0.20-2. This leads to major pain due to keys longer than 767 bytes. MariaDB 10.2 (and MySQL 5.7) introduced the setting innodb_default_row_format that is DYNAMIC by default. These versions also changed the default values of the parameters innodb_large_prefix=ON and innodb_file_format=Barracuda. This would allow longer column index prefixes to be created. The original purpose of these parameters was to allow InnoDB to be downgraded to MySQL 5.1, which is long out of support. Every InnoDB version since MySQL 5.5 does support operation with the relaxed limits. We backport the parameter innodb_default_row_format to MariaDB 10.1, but we will keep its default value at COMPACT. This allows MariaDB 10.1 to be configured so that CREATE TABLE is less likely to encounter a problem with the limitation: loose_innodb_large_prefix=ON loose_innodb_default_row_format=DYNAMIC (Note that the setting innodb_large_prefix was deprecated in MariaDB 10.2 and removed in MariaDB 10.3.) The only observable difference in the behaviour with the default settings should be that ROW_FORMAT=DYNAMIC tables can be created both in the system tablespace and in .ibd files, no matter what innodb_file_format has been assigned to. Unlike MariaDB 10.2, we are not changing the default value of innodb_file_format, so ROW_FORMAT=COMPRESSED tables cannot be created without changing the parameter.
101 lines
4.4 KiB
Plaintext
101 lines
4.4 KiB
Plaintext
SET @row_format = @@GLOBAL.innodb_default_row_format;
|
|
SET @large_prefix = @@GLOBAL.innodb_large_prefix;
|
|
SET @file_format = @@GLOBAL.innodb_file_format;
|
|
SET GLOBAL innodb_file_format = barracuda;
|
|
# ###########################################################
|
|
# 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) ENGINE=InnoDB;
|
|
SHOW TABLE STATUS LIKE 'tab';
|
|
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
|
|
tab InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL
|
|
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) ENGINE=InnoDB;
|
|
ALTER TABLE tab DISCARD TABLESPACE;
|
|
ALTER TABLE tab IMPORT TABLESPACE;
|
|
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x1)
|
|
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) ENGINE=InnoDB;
|
|
SHOW TABLE STATUS LIKE 'tab';
|
|
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
|
|
tab InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL
|
|
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;
|
|
SET GLOBAL innodb_large_prefix=ON;
|
|
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;
|
|
SHOW TABLE STATUS LIKE 'tab';
|
|
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
|
|
tab InnoDB # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL
|
|
INSERT INTO tab(a,b) VALUES(1,'Check with max column size');
|
|
SELECT * FROM tab;
|
|
a b
|
|
1 Check with max column size
|
|
SET GLOBAL innodb_default_row_format=COMPACT;
|
|
ALTER TABLE tab ROW_FORMAT=COMPACT;
|
|
ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
|
|
DROP TABLE tab;
|
|
SET GLOBAL innodb_default_row_format=Default;
|
|
SELECT @@innodb_default_row_format;
|
|
@@innodb_default_row_format
|
|
compact
|
|
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(767))) ENGINE= InnoDB;
|
|
SHOW TABLE STATUS LIKE 'tab';
|
|
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
|
|
tab InnoDB # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL
|
|
INSERT INTO tab(a,b) VALUES(1,'Check with max column size');
|
|
SELECT * FROM tab;
|
|
a b
|
|
1 Check with max column size
|
|
ALTER TABLE tab ROW_FORMAT=COMPACT;
|
|
SHOW TABLE STATUS LIKE 'tab';
|
|
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
|
|
tab InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=COMPACT
|
|
SELECT * FROM tab;
|
|
a b
|
|
1 Check with max column size
|
|
ALTER TABLE tab ROW_FORMAT=COMPRESSED;
|
|
SELECT * FROM tab;
|
|
a b
|
|
1 Check with max column size
|
|
ALTER TABLE tab ROW_FORMAT=Dynamic;
|
|
SHOW TABLE STATUS LIKE 'tab';
|
|
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
|
|
tab InnoDB # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=DYNAMIC
|
|
DROP TABLE tab;
|
|
SET GLOBAL innodb_default_row_format = @row_format;
|
|
SET GLOBAL innodb_large_prefix = @large_prefix;
|
|
SET GLOBAL innodb_file_format = @file_format;
|