什么是 MySQL 数据库引擎?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4233816/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What are MySQL database engines?
提问by pavanred
I looked around and found some of the MySQL engines are innodb and MyISAM. Perhaps there are few more. My question is what are these database engines?
我环顾四周,发现一些 MySQL 引擎是 innodb 和 MyISAM。也许还有几个。我的问题是这些数据库引擎是什么?
What are the differences between different MySQL engines? And more importantly, How do I decide which one to use?
不同的 MySQL 引擎有什么区别?更重要的是,我如何决定使用哪一个?
回答by Vincent Savard
mysql> SHOW ENGINES;
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| InnoDB | YES | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
I personally always use InnoDB if I have to use MySQL. It supports transaction and foreign keys while MyISAM doesn't.
如果我必须使用 MySQL,我个人总是使用 InnoDB。它支持事务和外键,而 MyISAM 不支持。
回答by GolezTrol
MyISAM and InnoDB are the most commonly used engines.
MyISAM 和 InnoDB 是最常用的引擎。
MyISAM is slightly faster than InnoDB, and implements the FULLTEXT index which is quite useful for integrating search capabilities. MyISAM is not transacted and doesn't implement foreign key constraints, which is a major drawback.
MyISAM 比 InnoDB 稍快,并且实现了 FULLTEXT 索引,这对于集成搜索功能非常有用。MyISAM 不是事务性的,也没有实现外键约束,这是一个主要的缺点。
But you can use the best of both and create tables with different storage engines. Some software (WordPress, I think) use Inno for most data, like relations between pages, versions etc. Records for the posts contain an ID that links to a record in a separate content table that uses MyISAM. That way, the content is stored in the table that has the best search capabilities, while most other data is stored in tables that enforce data integrity.
但是您可以充分利用两者的优点并创建具有不同存储引擎的表。某些软件(我认为是 WordPress)将 Inno 用于大多数数据,例如页面之间的关系、版本等。帖子的记录包含一个 ID,该 ID 链接到使用 MyISAM 的单独内容表中的记录。这样,内容存储在具有最佳搜索功能的表中,而大多数其他数据存储在强制执行数据完整性的表中。
If I were you, I'd pick Inno, because it is the most reliable. Only use MyISAM for specific purposes if you need to.
如果我是你,我会选择 Inno,因为它是最可靠的。如果需要,仅将 MyISAM 用于特定目的。
You can configure your database to use InnoDB by default when creating new tables.
创建新表时,您可以将数据库配置为默认使用 InnoDB。
回答by rajangupta
Different storage engines available, there are few reasons not to use either the MyISAM or InnoDB engine types. MyISAM will do in most situations, but if you have a high number of updates or inserts compared to your searches and selects then you will get better performance out of the InnoDB engine. To get the best performance out of InnoDB you need to tweak the parameters for your server, otherwise there is no reason not to use it.
可用的存储引擎不同,几乎没有理由不使用 MyISAM 或 InnoDB 引擎类型。MyISAM 在大多数情况下都可以,但如果与搜索和选择相比,您有大量更新或插入,那么您将从 InnoDB 引擎中获得更好的性能。为了从 InnoDB 获得最佳性能,您需要调整服务器的参数,否则没有理由不使用它。
The MERGE engine is an exceedingly effective way of querying data from multiple, identically defined, tables. The MEMORY engine is the best way to perform a large number of complex queries on data that would be inefficient to search on a disk based engine. The CSV engine is a great way to export data that could be used in other applications. BDB is excellent for data that has a unique key that is frequently accessed.
MERGE 引擎是从多个相同定义的表中查询数据的极其有效的方式。MEMORY 引擎是对在基于磁盘的引擎上搜索效率低下的数据执行大量复杂查询的最佳方式。CSV 引擎是导出可用于其他应用程序的数据的好方法。BDB 非常适合具有经常访问的唯一键的数据。
回答by Mogli
Maybe you will get more info here: https://en.wikipedia.org/wiki/Database_engine
也许您会在这里获得更多信息:https: //en.wikipedia.org/wiki/Database_engine
A database engine (or storage engine) is the underlying software component that a database management system (DBMS) uses to create, read, update and delete (CRUD) data from a database. Most database management systems include their own application programming interface (API) that allows the user to interact with their underlying engine without going through the user interface of the DBMS.
数据库引擎(或存储引擎)是数据库管理系统 (DBMS) 用于从数据库创建、读取、更新和删除 (CRUD) 数据的底层软件组件。大多数数据库管理系统都包含自己的应用程序编程接口 (API),允许用户与其底层引擎进行交互,而无需通过 DBMS 的用户界面。