简体   繁体   English

使用MyISAM和InnoDB表进行MySQL数据库维护

[英]MySQL Database Maintenance with MyISAM and InnoDB tables

I am new to MySQL and I am looking for some database maintenance tips. 我是MySQL的新手,正在寻找一些数据库维护技巧。

I have a older website that has a MySQL database version 5.1.29 with a mix of MyISAM and InnoDB tables. 我有一个较旧的网站,该网站的MySQL数据库版本为5.1.29,混合了MyISAM和InnoDB表。 99% of the tables are MyISAM and two of them are InnoDB. 99%的表是MyISAM,其中两个是InnoDB。

I found this nice article MySQL Maintenance Tasks for InnoDB with MySQL 5.1 that describes some maintenance tasks for InnoDB. 我发现这篇很好的文章,介绍了使用MySQL 5.1的InnoDB的MySQL维护任务,其中描述了InnoDB的一些维护任务。

What do you suggest for database maintenance in my environment? 您对我的环境中的数据库维护有何建议?

It depends on how your tables are used. 这取决于表的使用方式。 Those that are appended to and updated are usually about as optimal as they can get. 附加和更新的内容通常尽可能地最佳。 Those where you add and remove a large number of records can become more inefficient, but an OPTIMIZE TABLE on these will tighten them up. 那些在其中添加和删除大量记录的记录可能会变得效率低下,但是在这些记录上使用OPTIMIZE TABLE使它们更加OPTIMIZE TABLE

Although the "If it's not broke don't fix it" rule applies here, it's worth converting your MyISAM tables to InnoDB if you can do this on a test instance and no problems arise. 尽管此处适用“如果没有解决就不要修复”规则,但如果可以在测试实例上执行此操作,并且没有问题,则值得将MyISAM表转换为InnoDB。 MyISAM tables have a number of deficiencies, but the primary one is they're not journaled and can become corrupted beyond repair if you suffer a server crash at an unfortunate time. MyISAM表有许多缺陷,但是主要的缺陷是它们没有日志记录,如果不幸在不幸的时间里遭受服务器崩溃,则可能无法修复。

The best maintenance you can do on MySQL is by keeping the version up-to-date. 您可以在MySQL上进行的最佳维护是保持版本最新。 5.1 is a number of versions behind, and moving to 5.5 would provide significant performance benefits. 5.1落后许多版本,而升级到5.5将提供显着的性能优势。

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

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