本文介绍了MyISAM和InnoDB有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道此问题之前已被问过,但大多数时间被询问与特定数据库或表有关。我找不到在这个网站上的答案,描述这两个引擎及其差异,而不考虑某些特定的数据库。

I understand that this question has been asked before, but most of the time it is asked in relation to a specific database or table. I cannot find an answer on this site that describes the two engines and their differences without respect to someones specific database.

我想在未来就设计表或数据库做出更明智的决定,所以我寻找一个全面的答案,存储引擎。

I want to be able to make more informed decisions in the future with respect to designing a table or database, so am looking for a comprehensive answer on the differences between the two storage engines.

,在尝试在一个或另一个之间决定时,我应该寻找什么?

What's the difference between MyISAM and InnoDB, and what should I be looking for when trying to decide between one or the other?

推荐答案

InnoDB和MyISAM之间的主要区别(关于设计一个表或数据库

The main differences between InnoDB and MyISAM ("with respect to designing a table or database" you asked about) are support for "referential integrity" and "transactions".

如果您需要数据库来实施外键约束,或者您需要数据库来支持事务(即由两个或更多的DML操作作为单个工作单元处理,所有更改都已应用或所有更改已恢复),那么您将选择InnoDB引擎,因为MyISAM引擎中没有这些功能。

If you need the database to enforce foreign key constraints, or you need the database to support transactions (i.e. changes made by two or more DML operations handled as single unit of work, with all of the changes either applied, or all the changes reverted) then you would choose the InnoDB engine, since these features are absent from the MyISAM engine.

这是两个最大的区别。另一个很大的区别是并发。使用MyISAM,DML语句将获得表上的排它锁,并且在该锁被保持时,没有其他会话可以对表执行SELECT或DML操作。

Those are the two biggest differences. Another big difference is concurrency. With MyISAM, a DML statement will obtain an exclusive lock on the table, and while that lock is held, no other session can perform a SELECT or a DML operation on the table.

你问的两个特定引擎(InnoDB和MyISAM)有不同的设计目标。 MySQL还有其他存储引擎,有自己的设计目标。

Those two specific engines you asked about (InnoDB and MyISAM) have different design goals. MySQL also has other storage engines, with their own design goals.

因此,在选择InnoDB和MyISAM时,第一步是确定是否需要提供的功能InnoDB。

So, in choosing between InnoDB and MyISAM, the first step is in determining if you need the features provided by InnoDB. If not, then MyISAM is up for consideration.

对于差异的更详细的讨论是不切实际的(在这个论坛中),没有对问题空间的更详细的讨论。 。应用程序如何使用数据库,多少表,表大小,事务负载,select,insert,更新,并发要求,复制功能等。

A more detailed discussion of differences is rather impractical (in this forum) absent a more detailed discussion of the problem space... how the application will use the database, how many tables, size of the tables, the transaction load, volumes of select, insert, updates, concurrency requirements, replication features, etc.

数据库的逻辑设计应以数据分析和用户需求为中心;使用关系数据库的选择将来会更晚,甚至后来将选择MySQL作为关系数据库管理系统,然后为每个表选择一个存储引擎。

The logical design of the database should be centered around data analysis and user requirements; the choice to use a relational database would come later, and even later would the the choice of MySQL as a relational database management system, and then the selection of a storage engine for each table.

这篇关于MyISAM和InnoDB有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 00:58