Should I use MyISAM or InnoDB Tables for my MySQL Database?

后端 未结 4 2124
没有蜡笔的小新
没有蜡笔的小新 2020-12-06 01:34

I have the following two tables in my database (the indexing is not complete as it will be based on which engine I use):

Table 1:



        
4条回答
  •  失恋的感觉
    2020-12-06 02:36

    Always use InnoDB by default.

    In MySQL 5.1 later, you should use InnoDB. In MySQL 5.1, you should enable the InnoDB plugin. In MySQL 5.5, the InnoDB plugin is enabled by default so just use it.

    The advice years ago was that MyISAM was faster in many scenarios. But that is no longer true if you use a current version of MySQL.

    There may be some exotic corner cases where MyISAM performs marginally better for certain workloads (e.g. table-scans, or high-volume INSERT-only work), but the default choice should be InnoDB unless you can prove you have a case that MyISAM does better.

    Advantages of InnoDB besides the support for transactions and foreign keys that is usually mentioned include:

    • InnoDB is more resistant to table corruption than MyISAM.
    • Row-level locking. In MyISAM, readers block writers and vice-versa.
    • Support for large buffer pool for both data and indexes. MyISAM key buffer is only for indexes.
    • MyISAM is stagnant; all future development will be in InnoDB.

    See also my answer to MyISAM versus InnoDB

提交回复
热议问题