`

MySql InnoDB 和 MyISAM优缺点比较

阅读更多

MySQL Engines: InnoDB vs. MyISAM – A Comparison of Pros and Cons

by YANG YANG on SEPTEMBER 2, 2009

  • <iframe style="padding: 0px; margin: 0px; border-style: none; overflow: hidden; width: 45px; height: 62px;" src="http://www.facebook.com/plugins/like.php?href=http://www.kavoir.com/2009/09/mysql-engines-innodb-vs-myisam-a-comparison-of-pros-and-cons.html&amp;layout=box_count&amp;show_faces=false&amp;width=60&amp;action=like&amp;colorscheme=light&amp;height=45" frameborder="0" scrolling="no"></iframe>

The 2 major types of table storage engines for MySQL databases are InnoDB and MyISAM. To summarize the differences of features and performance,

  1. InnoDB is newer while MyISAM is older.
  2. InnoDB is more complex while MyISAM is simpler.
  3. InnoDB is more strict in data integrity while MyISAM is loose.
  4. InnoDB implements row-level lock for inserting and updating while MyISAM implements table-level lock.
  5. InnoDB has transactions while MyISAM does not.
  6. InnoDB has foreign keys and relationship contraints while MyISAM does not.
  7. InnoDB has better crash recovery while MyISAM is poor at recovering data integrity at system crashes.
  8. MyISAM has full-text search index while InnoDB has not.

In light of these differences, InnoDB and MyISAM have their unique advantages and disadvantages against each other. They each are more suitable in some scenarios than the other.

Advantages of InnoDB

  1. InnoDB should be used where data integrity comes a priority because it inherently takes care of them by the help of relationship constraints and transactions.
  2. Faster in write-intensive (inserts, updates) tables because it utilizes row-level locking and only hold up changes to the same row that’s being inserted or updated.

Disadvantages of InnoDB

  1. Because InnoDB has to take care of the different relationships between tables, database administrator and scheme creators have to take more time in designing the data models which are more complex than those of MyISAM.
  2. Consumes more system resources such as RAM. As a matter of fact, it is recommended by many that InnoDB engine be turned off if there’s no substantial need for it after installation of MySQL.
  3. No full-text indexing.

Advantages of MyISAM

  1. Simpler to design and create, thus better for beginners. No worries about the foreign relationships between tables.
  2. Faster than InnoDB on the whole as a result of the simpler structure thus much less costs of server resources.
  3. Full-text indexing.
  4. Especially good for read-intensive (select) tables.

Disadvantages of MyISAM

  1. No data integrity (e.g. relationship constraints) check, which then comes a responsibility and overhead of the database administrators and application developers.
  2. Doesn’t support transactions which is essential in critical data applications such as that of banking.
  3. Slower than InnoDB for tables that are frequently being inserted to or updated, because the entire table is locked for any insert or update.

The comparison is pretty straightforward. InnoDB is more suitable for data critical situations that require frequent inserts and updates. MyISAM, on the other hand, performs better with applications that don’t quite depend on the data integrity and mostly just select and display the data.

分享到:
评论

相关推荐

    MySQL存储引擎之争-InnoDB与MyISAM全面对决

    本文深入对比分析了MySQL的两大存储引擎InnoDB和MyISAM之间的区别,包括事务支持、数据恢复能力、并发控制、存储空间占用和读取性能等多个维度。通过详细的技术和场景分析, objectively评估两者的优缺点,并给出选择...

    浅谈MySQL存储引擎选择 InnoDB与MyISAM的优缺点分析

    MyISAM 是MySQL中默认的存储引擎,一般来说不是有太多人关心这个东西。决定使用什么样的存储引擎是一个很tricky的事情,但是还是值我们去研究一下,这里的文章只考虑 MyISAM 和InnoDB这两个,因为这两个是最常见的

    mysql 中InnoDB和MyISAM的区别分析小结

    InnoDB和MyISAM是在使用MySQL最常用的两个表类型,各有优缺点,视具体应用而定。基本的差别为:MyISAM类型不支持事务处理等高级处理,而InnoDB类型支持。MyISAM类型的表强调的是性能,其执行数度比InnoDB类型更快,...

    Mysql InnoDB和MyISAM区别原理解析

    mysql支持很多表类型的表(即存储引擎),如myisam、innodb、memory、archive、example等。每种存储引擎都有自己的优点和缺点,充分的理解每种存储引擎,有助于合理的使用它们。有人认为在同一个数据库中使用多种...

    MySQL InnoDB和MyISAM数据引擎的差别分析

    InnoDB和MyISAM是在使用MySQL最常用的两个表类型,各有优缺点,视具体应用而定。基本的差别为:MyISAM类型不支持事务处理等高级处理,而InnoDB类型支持

    MySQL存储引擎中的MyISAM和InnoDB区别详解

    在使用MySQL的过程中对MyISAM和InnoDB这两个概念存在了些疑问,到底两者引擎有何分别一直是存在我心中的疑问。为了解开这个谜题,搜寻了网络,找到了如下信息: MyISAM是MySQL的默认数据库引擎(5.5版之前),由...

    简单了解mysql InnoDB MyISAM相关区别

    每种存储引擎都有自己的优点和缺点,充分的理解每种存储引擎,有助于合理的使用它们。有人认为在同一个数据库中使用多种存储引擎很影响性能,其实这是一种十分错误的想法。实际上,除非是非常简单的数据库,否则的话...

    常见的mysql面试题

    1、MySQL中InnoDB和MyISAM两个存储引擎的差异是什么? 2、解释一下InnoDB存储引擎中B+树索引的工作方式以及与MyISAM存储引擎的差异。 3、解释什么是覆盖索引,以及它在查询优化中的重要作用。 4、能否解释一下MySQL...

    BAT面试突击资料.zip

    数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)..._mysql 面试题 2020

    MySQL MyISAM 优化设置点滴

    Mysql中的InnoDB和MyISAM是在使用MySQL中最常用的两个表类型,各有优缺点.两种类型最主要的差别就是 InnoDB 支持事务处理与外键和行级锁.而MyISAM不支持.所以Myisam往往就容易被人认为只适合在小项目中使用。但是从...

    MySQL面试题,面试资料

    准备MySQL面试?想要在数据库领域脱颖而出?那就来了解一下MySQL吧!作为一款成熟且被广泛采用的数据库系统,MySQL将为您的面试保驾护航,帮助您困扰的问题...什么是数据库范式化和反范式化,它们有何区别和优缺点?

    常见(MySQL)面试题(含答案).docx

    MyisAM和innodb的有关索引的疑问 innodb为什么要用自增id作为主键 MySql索引是如何实现的 说说分库与分表设计(面试过) 聚集索引与非聚集索引的区别 事务四大特性(ACID)原子性、一致性、隔离性、持久性? 事务的...

    MySQL面试题-2023

    MySQL如何执行数据的备份和恢复? MySQL中什么是主键?在MySQL中如何定义一个主键? 什么是SQL注入?如何防止? ...MySQL中有哪些索引类型?... MySQL的InnoDB和MyISAM两个存储引擎各有什么优缺点?

    MySQL的面试题,共计20道题,主要是MySQL的面试

    MySQL的面试题, 解释MySQL中的ACID是什么? 在MySQL中,InnoDB和MyISAM存储引擎的主要区别是什么?你更倾向于使用哪个,为什么? 解释一下MySQL的索引是什么?它的种类和优缺点是什么?

    浅谈MyISAM 和 InnoDB 的区别与优化

    InnoDB和MyISAM是在使用MySQL最常用的两个表类型,各有优缺点,视具体应用而定。下面我们就来具体探讨下吧

    MySQL面试题精选35题

    2.MySQL 查询缓存有什么优缺点? 3.MySQL 的常用引擎都有哪些? 4.常用的存储引擎 InnoDB 和 MyISAM 有什么区别? 5.什么叫回表查询? 6.如果把一个 InnoDB 表的主键删掉,是不是就没有主键,就没办法进行回表查询了...

    MyISAM和InnoDB引擎优化分析

    这几天喻名堂在学习mysql数据库的优化并在自己的服务器上进行设置,喻名堂主要学习了MyISAM和InnoDB两种引擎的优化方法,它们各有优缺点,一般在实际应用中将两种引擎结合起来使用效果会更好。喻名堂测试的硬件配置...

    MySQL自整理超全精华版面试八股文

    MyISAM和InnoDB的区别 一条SQL语句在ySQL中如何被执行的? 索引 什么是索引 索引的优缺点 MySQL的索引有哪些? B树和B+树有什么异同? MySQL为什么使用B+树而不是B树? 主键索引和辅助索引(二级索引) 聚簇索引和非...

    MySql事务无法回滚的原因有哪些

    InnoDB和MyISAM是在使用MySQL最常用的两个表类型,各有优缺点,视具体应用而定。基本的差别为:MyISAM类型不支持事务处理等高级处理,而InnoDB类型支持。MyISAM类型的表强调的是性能,其执行数度比InnoDB类型更快,...

Global site tag (gtag.js) - Google Analytics