简体   繁体   English

MySQL(Myisam)变量设置

[英]Mysql (Myisam) variable setting

I have a single processor dedicated server with 4GB RAM and a 400MB Mysql database (Myisam) who has big performance problems. 我有一台具有4GB RAM和400MB Mysql数据库(Myisam)的单处理器专用服务器,但该服务器存在很大的性能问题。 The database is used by an ecommerce. 该数据库由电子商务使用。 I already tryied to tune it using the mysqltuner script, but without good results. 我已经尝试使用mysqltuner脚本对其进行调整,但是效果不佳。 Because the variable settings have been modified several times, I would like to have a basic configuration to start from, thereafter try to tune it. 因为变量设置已被修改过几次,所以我想从一个基本配置开始,然后尝试对其进行调整。

Try this tool, it always show good results for performance tuning. 尝试使用此工具,它对于性能调整始终显示出良好的效果。

https://tools.percona.com/wizard https://tools.percona.com/wizard

For ecommerce, you need InnoDB. 对于电子商务,您需要InnoDB。 If you don't change, you will be burned badly when a crash occurs at just the wrong instant in a monetary transaction. 如果您不进行更改,则在货币交易的错误时刻发生崩溃时,您将被严重烧伤。

Make that change, then 进行更改, 然后

key_buffer_size = 20M
innodb_buffer_pool_size = 1000M

read my blog on moving from MyISAM to InnoDB . 阅读有关从MyISAM迁移到InnoDB的博客。

When you then find that things are not working fast enough, do 当您发现事情进行得不够快时,请执行

  • long_query_time = 1 long_query_time = 1
  • turn on the slowlog 打开慢速日志
  • wait a day 等一天
  • run pt-query-digest to find the worst couple of queries 运行pt-query-digest查找最差的几个查询
  • present them to us for critique. 提出他们给我们批评。 The solution could be as simple as adding an composite index. 该解决方案可以像添加复合索引一样简单。 Or maybe reformulating a SELECT. 或者重新编写一个SELECT。

I have redirected you toward slow queries because you cannot "tune" your way out of bad schema, bad queries, etc. 我已将您重定向到慢速查询,因为您无法从错误的架构,错误的查询等中“调整”自己的出路。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM