InnoDb 比 MyISAM 更适合频繁的并发更新和插入,我这样说对吗?

发布于 2024-08-11 07:28:37 字数 223 浏览 7 评论 0原文

我们的网站每天有数百名访问者和数以万计的查询。 因此,数据库中的某些表很少更新,有些表每分钟更新几次,有些表每秒更新约 10 次。
MyISAM 使用表级锁定进行更新,InnoDb 使用行级锁定。
因此,据我了解,对于频繁并发更新(每秒几次更新)的表,最好将它们设为InnoDb,而对于其他表(当然,如果我们不需要事务和外键) )用MyISAM引擎就可以了。
我的想法对吗?

We have a websites with hundreds of visitors every day and tens of thousands queries a day.
So, some tables in the database are updated very rarely, some tables are updated few times a minute and some tables are updated ~10 times a seconds.
MyISAM uses table-level locking for updates and InnoDb uses row-level locking.
So, as I understand, for tables with frequent concurrent updates (several updates per second) it is better to make them InnoDb, and for other tables (if we don't need transactions and foreign keys of course) it is ok to be with MyISAM engine.
Am I right in my thoughts?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

暖阳 2024-08-18 07:28:37

MyISAM 的读取和写入速度更快,但不是同时。换句话说,如果您需要进行大量写入,它会更快,但如果您还想让人们同时读取,则读取器和写入器将相互阻塞,并且可能会出现并发问题。在这种情况下,您应该使用 InnoDB,并且大多数 mysql 专家都建议默认使用 InnoDB,因为它被认为比 MyISAM 更可靠,尽管在某些用例下速度较慢。

MyISAM is faster for reads and writes, but not at the same time. In other words, if you need to do a lot of writes, it will be faster, but if you want to also have people reading at the same time the readers and the writers will block each other and you may have concurrency issues. You should use InnoDB in such scenarios, and most mysql gurus recommend using InnoDB by default anyway because it's considered more generally reliable than MyISAM, despite being slower under some use cases.

李不 2024-08-18 07:28:37

是的,我相信是这样。我自己是MySQL的新手,但是当我安装它时,它解释了innoDB针对事务、操作系统进行了优化,而MyISAM则非常适合报告/DW系统。

Yes, I believe so. I am a newcomer to MySQL myself, but when I installed it, it explained that innoDB is optimised for transactional, operational systems, and MyISAM is great for reporting/DW systems.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文