mysql - 如何将 Amazon RDS mysql.slow_log 表引擎更改为 innodb

标签 mysql amazon-rds

mysql.slow_log表默认引擎是CSV,CSV引擎没有索引; 当数据量很大时,该引擎性能非常慢;

如何将Amamon RDS mysql.slow_log表的引擎更改为innodb

最佳答案

简短的回答是你不能这样做。长答案是 MySQL 文档 log destinations说:

The log tables can be altered to use the MyISAM storage engine. You cannot use ALTER TABLE to alter a log table that is in use. The log must be disabled first. No engines other than CSV or MyISAM are legal for the log tables.

To disable logging so that you can alter (or drop) a log table, you can use the following strategy. The example uses the general query log; the procedure for the slow query log is similar but uses the slow_log table and slow_query_log system variable.

SET @old_log_state = @@global.general_log;
SET GLOBAL general_log = 'OFF';
ALTER TABLE mysql.general_log ENGINE = MyISAM;
SET GLOBAL general_log = @old_log_state;

当然,您可以尝试将表引擎更改为innodb,看看亚马逊版本是否解除了限制,但只能在测试环境中进行。

关于mysql - 如何将 Amazon RDS mysql.slow_log 表引擎更改为 innodb,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40585021/

相关文章:

amazon-web-services - 允许 ICMP 后无法 ping AWS RDS 实例

postgresql - 如何将 Parquet 文件从 s3 导入 postgresql rds

php - PHP 和 MySQL 中的嵌套注释

mysql - 将数字条件与 like 组合中断 MySQL 查询

mysql - ON UPDATE RESTRICT 有什么作用?

php - 在 url 中,用什么来替换空格、+ 或破折号更好? url encode 做 + ,谷歌推荐破折号

mysql - 使用 MySQL 在同一个简单 SELECT 中进行不能作为子查询的多个查询,导致生成单个多行结果

mysql - EC2操作的明智替代解决方案

mysql - 拒绝访问;您需要(至少一个) super 权限才能执行此操作

mysql - 无法从 MySQL Workbench 连接到 RDS MySQL 数据库