2

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

4

1 回答 1

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.                                  |
+---------+------+-----------------------------------------------------------------------+

此外,除非您还启用了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.                          |
+---------+------+---------------------------------------------------------------+
于 2012-11-29T23:17:39.470 回答