我可以在一个数据库中使用 InnoDB 和 MyISAM 表吗?
显然两者都有各自的优点。 MyISAM 速度快,但可能容易崩溃,InnoDB 速度慢,但由于事务和外键而更稳定。因此,将两种引擎混合在一个数据库中可能会很好。如果可以的话?
Obviously both have their benefits. MyISAM is fast but may get currupted easily, InnoDB is slow but is more stable thanks to transactions and foreign keys. So it could be good to mix both engines in one database. If that's possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
摘自 MySQL - InnoDB 与 MyISAM
Taken from MySQL - InnoDB vs MyISAM
当然,这是可能的。
我一直这样做,因为我更喜欢 InnoDB 作为 FK,但有时我需要 MyISAM 来进行全文搜索。从来没有遇到过问题。
Sure, that's possible.
I do this all the time, because I prefer InnoDB for the FKs, but I sometimes need MyISAM for the full-text search. Never had a problem.
总之是的。 (CREATE TABLE 允许您指定引擎类型。)
但是,在跨多个表类型进行查询时必须小心。 (例如,您不能利用 MyISAM 上的外键,也不能提交影响 MyISAM 表的事务等。)
本质上,我怀疑这可能不是最好的方法。 (除非您只需要从数据库的其余部分中分割出来的一组定义的表的事务,并且 InnoDB 太慢,否则获得更快的数据库服务器可能会减轻痛苦。)
In a word yes. (CREATE TABLE lets you specify the engine type.)
However, you have to take care when you're querying across multiple table types. (For example you can't take advantage of foreign keys on MyISAM and you can't commit a transaction that affects MyISAM tables, etc.)
In essence, I suspect this might not be the best approach to take. (Unless you only need transactions for a defined set of tables that are segmented from the remainder of your database and InnoDB is too slow, getting a faster database server may well transpire to be less painful.)