os: centos 7.4
db: mysql 8.0
# cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core)
# mysql
root@localhost 08:03:03 [test]> select version();
+-----------+
| version() |
+-----------+
| 8.0.20 |
+-----------+
1 row in set (0.00 sec)
root@localhost 07:55:38 [test]> show table status like 'tmp_t100'\G
*************************** 1. row ***************************
Name: tmp_t100
Engine: InnoDB
Version: 10
Row_format: Dynamic
Rows: 994137
Avg_row_length: 100
Data_length: 100286464
Max_data_length: 0
Index_length: 54165504
Data_free: 4194304
Auto_increment: NULL
Create_time: 2020-09-10 07:45:39
Update_time: 2020-09-10 07:27:07
Check_time: NULL
Collation: utf8mb4_0900_ai_ci
Checksum: NULL
Create_options:
Comment:
1 row in set (0.00 sec)
root@localhost 08:01:24 [test]> select * from information_schema.innodb_tables where name='test/tmp_t100'\G
*************************** 1. row ***************************
TABLE_ID: 1083
NAME: test/tmp_t100
FLAG: 33
N_COLS: 6
SPACE: 26
ROW_FORMAT: Dynamic
ZIP_PAGE_SIZE: 0
SPACE_TYPE: Single
INSTANT_COLS: 0
1 row in set (0.00 sec)
The default row format is defined by innodb_default_row_format, which has a default setting of DYNAMIC. The default row format is used when the ROW_FORMAT option is not defined or when ROW_FORMAT=DEFAULT is used.
If the ROW_FORMAT option is not defined, or if ROW_FORMAT=DEFAULT is used, operations that rebuild a table also silently change the row format of the table to the default defined by innodb_default_row_format.
root@localhost 00:48:07 [test]> show global variables like '%innodb_default_row_format%';
+---------------------------+---------+
| Variable_name | Value |
+---------------------------+---------+
| innodb_default_row_format | dynamic |
+---------------------------+---------+
1 row in set (0.01 sec)
ROW_FORMAT=FIXED is not supported.
If ROW_FORMAT=FIXED is specified while innodb_strict_mode is disabled, InnoDB issues a warning and assumes ROW_FORMAT=DYNAMIC.
If ROW_FORMAT=FIXED is specified while innodb_strict_mode is enabled, which is the default, InnoDB returns an error.
The COMPRESSED row format is a variation of the COMPACT row format.
The REDUNDANT format provides compatibility with older versions of MySQL.
The COMPACT row format reduces row storage space by about 20% compared to the REDUNDANT row format, at the cost of increasing CPU use for some operations. If your workload is a typical one that is limited by cache hit rates and disk speed, COMPACT format is likely to be faster. If the workload is limited by CPU speed, compact format might be slower.
参考:
https://dev.mysql.com/doc/refman/8.0/en/create-table.html
https://dev.mysql.com/doc/refman/8.0/en/innodb-row-format.html#innodb-row-format-defining
https://dev.mysql.com/doc/refman/8.0/en/innodb-row-format.html#innodb-row-format-dynamic
https://dev.mysql.com/doc/refman/8.0/en/innodb-row-format.html#innodb-row-format-compressed
https://dev.mysql.com/doc/refman/8.0/en/innodb-row-format.html#innodb-row-format-redundant
https://dev.mysql.com/doc/refman/8.0/en/innodb-row-format.html#innodb-row-format-compact