我正在开发一个浏览器应用程序,它通过 php 站点连接到多个 MySQL 数据库。这些数据库设置在单个 AWS RDS 实例上。当我设置这些数据库时,我对不同的数据库引擎不是很了解。在了解了不同类型之后,我决定使用 InnoDB 来满足低 IOPS 需求,而使用 MyISAM 来满足高 IOPS 需求,因为我读到它在某些任务中速度更快。
亚马逊网络服务告诉我:
DB Instance test-1 contains MyISAM tables that have not been migrated to InnoDB. These tables can impact your ability to perform point-in-time restores. Consider converting these tables to InnoDB. Please refer to http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.BackingUpAndRestoringAmazonRDSInstances.html#Overview.BackupDeviceRestrictions
我应该使用 InnoDB 重新创建 MyISAM 数据库吗?
最佳答案
关于 MyISAM 比 InnoDB 更快的比喻是 2000 年代中期最新代码的遗留问题。
对于大多数类型的查询,MyISAM 不再比 InnoDB 快。查看此博客中 2007 年的基准测试:https://www.percona.com/blog/2007/01/08/innodb-vs-myisam-vs-falcon-benchmarks-part-1/
从那时起,InnoDB 变得更好、更快、更可靠。 MyISAM 尚未开发。
更新:在 MySQL 8.0 中,连系统表都已转换为 InnoDB。显然有逐步淘汰 MyISAM 的意图。我希望它会在未来的 MySQL 版本中被弃用然后删除(但我不能说从现在开始多少年)。
在一些边缘情况下,MyISAM 可能会更快,例如表扫描。但是你真的不应该为表扫描优化你的数据库。您应该创建正确的索引以避免表扫描。
Update Feb 2018: MyISAM just suffered an additional 40% performance hit from the recent fix for the Meltdown CPU bug, and this affects table-scans. Assuming you are responsible and patch your systems to fix the Meltdown vulnerability, MyISAM is now a performance liability. See current tests of MyISAM performance with the patch: https://mariadb.org/myisam-table-scan-performance-kpti/
但最重要的是 InnoDB 支持 ACID 行为,而 MyISAM 不支持 ACID 的四种特性中的任何。请参阅我对 MyISAM versus InnoDB 的回答
不支持 ACID 不仅仅是一个学术观点。它转化为更新期间的表锁和备份期间的全局锁。
关于mysql - 我应该将我的数据库从 MyISAM 更改为 InnoDB 吗? (AWS 通知),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40690224/