更改行格式时,为什么我的表格大小没有减少?

use*_*449 2 mysql innodb

我们目前正在使用带有innodb的MySQL,我们有一些紧凑的大型表格.当我将行格式更改为压缩时,我们仍然看到表格的大小相同.有谁知道这个的原因?

Bil*_*win 6

是否有可能为表声明ROW_FORMAT = COMPRESSED,但是您没有启用配置值innodb_file_format = BARRACUDA?

如果您不执行后一步骤,那么对梭子鱼行格式的任何请求都不会生效.这样的请求会产生一个警告:

mysql> alter table foo row_format=compressed;
Query OK, 0 rows affected, 2 warnings (0.03 sec)
Records: 0  Duplicates: 0  Warnings: 2

mysql> show warnings;
+---------+------+-----------------------------------------------------------------------+
| Level   | Code | Message                                                               |
+---------+------+-----------------------------------------------------------------------+
| Warning | 1478 | InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope. |
| Warning | 1478 | InnoDB: assuming ROW_FORMAT=COMPACT.                                  |
+---------+------+-----------------------------------------------------------------------+
Run Code Online (Sandbox Code Playgroud)

此外,除非您也启用,否则不能使用压缩行格式innodb_file_per_table.

mysql> alter table foo row_format=compressed;
Query OK, 0 rows affected, 2 warnings (0.03 sec)
Records: 0  Duplicates: 0  Warnings: 2

mysql> show warnings;
+---------+------+---------------------------------------------------------------+
| Level   | Code | Message                                                       |
+---------+------+---------------------------------------------------------------+
| Warning | 1478 | InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table. |
| Warning | 1478 | InnoDB: assuming ROW_FORMAT=COMPACT.                          |
+---------+------+---------------------------------------------------------------+
Run Code Online (Sandbox Code Playgroud)