一个数据库中的MyISAM和InnoDB表 [英] MyISAM and InnoDB tables in one database

查看:60
本文介绍了一个数据库中的MyISAM和InnoDB表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大约有30个表的数据库,其中5个表是写密集型的.

I have a database with about 30 tables and 5 tables of them is write-intensive.

我正在考虑

  1. 转换5个写密集型表以使用InnoDB引擎,其余的保留在MyISAM引擎上

  1. Convert 5 write-intensive tables to use InnoDB engine and keep the rest on MyISAM engine

将所有表转换为使用InnoDB引擎.

Convert all tables to use InnoDB engine.

我想知道哪种方法更好吗?

I wonder which approach is better?

更具体

我想在MyISAM引擎上保留一些表的原因是其中一些表大约有1,000,000行.我不确定在转换为InnoDB之后,这些表上的"SELECT COUNT(*)"之类的查询会变慢多少.

The reason I want to keep some table on MyISAM engine is some of them has around 1,000,000 rows. I'm not sure how slower it will be for queries like "SELECT COUNT(*)" on these tables after converted to InnoDB.

我还没有做测试.我希望在开始切换之前先从大家中获取一些建议.

I haven't done a test. I prefer getting some advices from any of you before start the switch.

推荐答案

这些天来,我总是默认使用InnoDB,尤其是在您提到的MyISAM遭受全表锁定的情况下,在写密集型表上.这是要点比较.

These days, I always default to using InnoDB, especially on the write-intensive tables you mention where MyISAM suffers from full table locking. Here's a to-the-point comparison.

使用MyISAM的原因:

Reasons to use MyISAM:

  • 表对于选择繁重的负载确实非常快
  • 表级锁限制了它们在写密集型多用户环境中的可伸缩性.
  • 最小的磁盘空间消耗
  • 全文索引
  • 合并和压缩的表.

使用InnoDB的原因:

Reasons to use InnoDB:

  • ACID交易
  • 行级锁定
  • 一致的读取–使您达到出色的读写并发性.
  • 主键群集–在某些情况下可提供出色的性能.
  • 外键支持.
  • 索引和数据页都可以缓存.
  • 自动崩溃恢复-万一MySQL关闭不干净,InnoDB表仍将-恢复到一致状态-无需像MyISAM那样的检查/修复.
  • 所有更新都必须通过InnoDB中的事务引擎,与非事务存储引擎相比,这通常会降低性能.

以上内容摘自

The above was taken from this site, which no longer seems to be working.

这篇关于一个数据库中的MyISAM和InnoDB表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆