InnoDB 性能调整
我正在将一个大表从 myISAM 切换到 InnoDB。关于为什么切换有意义已经有很多讨论,但关于如何在确保表性能良好的同时进行切换的讨论却很少。
假设我的数据库中有 InnoDB 和 MyISAM 表,我是否应该更改 MySQL conf 文件中的参数以提高性能?
还有其他可以提高默认值来调整性能的吗?
I'm switching a large table to InnoDB from myISAM. There has been a lot of discussion regarding why switching makes sense, but not much about HOW to do it while making sure the table performs well.
Assuming I'll have InnoDB and MyISAM tables in on database, are there parameters I should change in the MySQL conf file to facilitate better performance?
Any other defaults that can be bumped up to tweak performance?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的 innodb_buffer_pool_size 应设置为您拥有的 InnoDB 数据和索引。运行这个查询,它会告诉你mysql当前Innodb数据的最低推荐设置
如果你的InnoDB数据远远超过数据库服务器上安装的RAM,我建议使用机器上安装的RAM的75%。因此,如果您有 16GB 的服务器,请使用 12G 作为 innodb_buffer_pool_size。
您还必须将 innodb_log_file_size 设置为 innodb_buffer_pool_size 的 25% 或 2047M,以较小者为准。要更改文件 ib_logfile0 和 ib_logfile1,您必须:
如果您使用 MySQL 5.5,请设置以下内容:
如果您将保留 MyISAM 数据,请运行此查询以获得 key_buffer_size 的理想设置:
UPDATE 2013-02-13 12:55 EDT
我有最近了解到不要将 innodb_io_capacity 设置得非常高,如果有的话。在商用硬件和虚拟机上尤其如此:
Your innodb_buffer_pool_size should be set to the amount of InnoDB data and indexes you have. Run this query and it will tell you the Minimum recommended setting for mysql's current Innodb Data
If your InnoDB data far exceeds the installed RAM on the DB server, I recommend 75% of the installed RAM on the box. So, if you have a 16GB server, use 12G as the innodb_buffer_pool_size.
You must also set innodb_log_file_size to 25% of innodb_buffer_pool_size or 2047M, which ever is smaller. To change the file ib_logfile0 and ib_logfile1, you must:
If you are using MySQL 5.5, set the following:
If you will retain MyISAM data run this query for the ideal setting for key_buffer_size:
UPDATE 2013-02-13 12:55 EDT
I have learned lately not to set innodb_io_capacity very high, if at all. This is especially true on commodity hardware and VMs: