https://dev.mysql.com/doc/refman/5.7/en/innodb-introduction.html
InnoDB is a general-purpose storage engine that balances high reliability and high performance.
InnoDB是一个通用的存储引擎,平衡了高可靠性和高性能。
In MySQL 5.7, InnoDB is the default MySQL storage engine.
在MySQL 5.7版本中,默认的MySQL存储引擎为InnoDB。
Unless you have configured a different default storage engine, issuing a CREATE TABLE statement without an ENGINE clause creates an InnoDB table.
除非你配置了不同的默认存储引擎,否则不带engine子句的CREATE TABLE语句将创建一个InnoDB表。
Its DML operations follow the ACID model, with transactions featuring commit, rollback, and crash-recovery capabilities to protect user data.
它的DML操作遵循ACID模型,事务具有提交、回滚和崩溃恢复功能,以保护用户数据。
Row-level locking and Oracle-style consistent reads increase multi-user concurrency and performance.
行级锁定和oracle风格的一致读取提高了多用户并发性和性能。
InnoDB tables arrange your data on disk to optimize queries based on primary keys.
InnoDB表在磁盘上排列数据,根据主键优化查询。
Each InnoDB table has a primary key index called the clustered index that organizes the data to minimize I/O for primary key lookups.
每个InnoDB表都有一个主键索引,称为聚集索引(clustered index),用于组织数据以最小化主键查找的I/O。
To maintain data integrity, InnoDB supports FOREIGN KEY constraints.
为了维护数据的完整性,InnoDB支持FOREIGN KEY约束。
With foreign keys, inserts, updates, and deletes are checked to ensure they do not result in inconsistencies across related tables.
使用外键,检查插入、更新和删除,以确保它们不会导致相关表之间的不一致。
Within MySQL, InnoDB plays an important role in data storage.
在MySQL中,InnoDB在数据存储中扮演着重要的角色
It is a storage subsystem and in recent years it has become one of the most popular choices thanks to its high levels of performance and reliability compared to other storage engines.
它是一个存储子系统,近年来,由于其与其他存储引擎相比具有较高的性能和可靠性,它已成为最受欢迎的选择之一。
Most storage engines either store the data on a disk or keep it in the main memory for quick access.
大多数存储引擎要么将数据存储在磁盘上,要么将数据保存在主存中以便快速访问。
InnoDB implements isolated transactions which means data is only written to the corresponding storage medium when a specific transaction is complete.
InnoDB实现隔离事务,这意味着只有在特定事务完成时,数据才会写入相应的存储介质。
This ensures incomplete changes are not stored to the database.
这确保不完整的更改不会存储到数据库中。
Each InnoDB table arranges the data on the disk in order to optimize queries with a primary key.
每个InnoDB表在磁盘上排列数据,以便用一个主键优化查询。
This makes access a little slower but also much more secure.
这使得访问速度稍慢,但也更加安全。
Data selection is relatively faster, but inserting and updating take longer.
数据选择相对更快,但插入和更新需要更长的时间。
As such, InnoDB is best suited to large databases and in particular those that contain lots of relational data.
因此,InnoDB最适合大型数据库,特别是那些包含大量关系数据的数据库。
As mentioned above, with InnoDB, all the data in a transaction is treated as a single unit.
如上所述,在InnoDB中,事务中的所有数据都被视为单个单元。
Consequently, if some of the data is deleted, InnoDB will automatically delete all of the referenced data too.
因此,如果删除了一些数据,InnoDB也会自动删除所有引用的数据。
This makes it much easier for users to maintain the referential integrityof the database.
这使得用户更容易维护数据库的引用完整性。
However, this referential integrity can only be maintained if it is defined in advance.
但是,只有预先定义了引用完整性,才能维护它。
The same principle can be used to lock write access to data records.
同样的原理可以用于锁定对数据记录的写访问。
The InnoDB table structure is saved in FRM files, user data, and indexes in a tablespace that is linked to the database.
InnoDB表结构保存在FRM文件、用户数据和连接到数据库的表空间中的索引中。
The tablespace can contain one or more files.
表空间可以包含一个或多个文件。
Referential integrity applies here too.
这里也适用参考完整性。
The tablespace can be configured across several directories, but this must be set up at the beginning and can’t be modified at a later date.
表空间可以跨多个目录配置,但必须在开始时设置,以后不能修改。
It might be helpful to think of working with InnoDB tables as partitioning a hard drive – changing things later on can lead to data loss.
把处理InnoDB表看作对硬盘驱动器进行分区可能会有所帮助——稍后更改会导致数据丢失。
One of the best-known uses of InnoDB is MediaWiki, the software that powers Wikipedia and other sites
MediaWiki是InnoDB最著名的应用之一,它支持维基百科和其他网站
InnoDB is newer and more modern than other MySQL storage engines.
InnoDB比其他MySQL存储引擎更新、更现代。
However, it’s also morecomplex and requires a much more powerful database environment.
然而,它也更复杂,需要更强大的数据库环境。
Despite this, website operators are increasingly relying on the capabilities (transactions, foreign keys) offered by the InnoDB/MySQL combination because web applications themselves are becoming ever more complex.
尽管如此,网站运营商越来越依赖于InnoDB/MySQL组合提供的功能(事务,外键),因为web应用程序本身变得越来越复杂。
All the processes on a website rely on reading database content.
网站上的所有进程都依赖于读取数据库内容。
InnoDB can slow down response times, such as when articles are updated or added.
InnoDB可以降低响应时间,比如当文章更新或添加时。
On the other hand, the critical part – delivering new content to site visitors – is much faster.
另一方面,关键部分——向网站访问者传递新内容——要快得多。
When used for a standard modern website, the pros and cons of InnoDB balance each other out.
当用于标准的现代网站时,InnoDB的优点和缺点相互抵消。
However, for e-commerce sites, the limits of InnoDB quickly become apparent.
然而,对于电子商务网站来说,InnoDB的局限性很快就显现出来。
For example, online booking systems are very write-heavy.
例如,在线预订系统需要大量的文字。
In this case, the write lock mechanism of InnoDB means this storage engine isn’t the best choice.
在这种情况下,InnoDB的写锁机制意味着这个存储引擎不是最好的选择。
Instead, you should use tables that allow better handling of writes, such as MyISAM.
相反,应该使用允许更好地处理写操作的表,例如MyISAM。
By far the most important point to note when using MySQL with InnoDB is that incorrect changes within the database can make an entire website unusable.
到目前为止,在使用MySQL和InnoDB时需要注意的最重要的一点是,数据库中不正确的更改会使整个网站不可用。
Before any modification is made, it’s therefore essential that the existing database is backed up.
因此,在进行任何修改之前,必须备份现有数据库。
That’s why InnoDB uses a transaction protocol that supports automatic recovery in the event of an error.
这就是为什么InnoDB使用事务协议来支持发生错误时的自动恢复。
Since version 5, MySQL has supported more than ten different storage engines.
从版本5开始,MySQL已经支持了十多种不同的存储引擎。
The best-known of these is MyISAM.
其中最著名的是MyISAM。
MyISAM stores the data from the individual tables in two files: a data file and an index file.
MyISAM将来自各个表的数据存储在两个文件中:一个数据文件和一个索引文件。
ISAM stands for Indexed Sequential Access Method.
ISAM代表索引顺序访问方法。
In other words, records are stored sequentially and only one user or application has write permission at any one time – although several users can still read a table at the same time.
换句话说,记录是按顺序存储的,任何时候只有一个用户或应用程序有写权限——尽管几个用户仍然可以同时读一个表。
If lots of small data packets need to be read quickly by many users at the same time, MyISAM can’t be beaten.
如果大量的小数据包需要被许多用户同时快速读取,MyISAM是无可匹敌的。
InnoDB is ACID-compliant (ACID: Atomicity, Consistency, Isolation and Durability).
InnoDB是ACID兼容的(ACID:原子性,一致性,隔离性和持久性)。
All of the transactions run in isolation, but any number of applications can write data to a table at the same time.
所有事务都独立运行,但任意数量的应用程序都可以同时向表写入数据。
In terms of data queries (SELECT), InnoDB is the clear winner, but when it comes to database writes (INSERT and UPDATE), MyISAM is somewhat faster.
在数据查询(SELECT)方面,InnoDB是明显的赢家,但当涉及到数据库写入(INSERT和UPDATE)时,MyISAM要快一些。
However, the lower speed of InnoDB is more than compensated for by its transaction protocol.
然而,InnoDB较低的速度被它的事务协议所弥补。
With MyISAM, there is no automatic crash recovery mechanism, so it’s important to create a backup before making any changes.
使用MyISAM时,没有自动崩溃恢复机制,因此在进行任何更改之前创建备份非常重要。
The InnoDB storage engine excels if you’re dealing with especially large or complex projects or data sets, but it’s not always a better choice than its predecessor, MyISAM.
InnoDB存储引擎在处理特别大或复杂的项目或数据集时表现出色,但它并不总是比它的前身MyISAM更好的选择。
For smaller applications and databases, MyISAM offers much higher performance.
对于较小的应用程序和数据库,MyISAM提供了更高的性能。
And in fact, you don’t necessarily have to choose between them.
事实上,你不一定要在它们之间做出选择。
If necessary, both storage engines can be used side by side within the same database.
如果有必要,两个存储引擎可以在同一个数据库中同时使用。