mysql - 为什么在更改行格式时我的表大小没有减小?

标签 mysql innodb

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

最佳答案

是否有可能您为表声明了 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.                          |
+---------+------+---------------------------------------------------------------+

关于mysql - 为什么在更改行格式时我的表大小没有减小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13636358/

相关文章:

MySQL 数据库加载速度非常慢

mysql - 使用 sum、where 条件和 group by 进行查询

php - MySQL 查询从 WordPress 数据库中获取最近的位置 WHERE 经度和纬度保存为后元

MySql - innodb - 复合键上的行级锁定如何用简单的话工作

java - 复杂的 INSERT 查询

mysql - 间歇性 MySQL 5.6 hibernate 错误 : Got error -1 from storage engine

php - 如何让 PHP 将 MySQL 中的空白字段转换为 "0"?

更新失败时Mysql事务回滚

MySQL - Left Join 耗时太长,如何优化查询?

mysql - 如何从数据库中删除一行