InnoDB 是一种通用存储引擎,兼顾高可靠性和高性能。在 MySQL 8.4 中,InnoDB 是默认的 MySQL 存储引擎。除非您已配置了其他默认存储引擎,否则在不带 ENGINE 子句的情况下执行 CREATE
TABLE 语句将创建一个 InnoDB 表。InnoDB is a general-purpose storage engine that
balances high reliability and high performance. In MySQL
8.4, InnoDB is the default MySQL
storage engine. Unless you have configured a different default
storage engine, issuing a CREATE
TABLE statement without an ENGINE
clause creates an InnoDB table.
InnoDB 的主要优势Key Advantages of InnoDB
其 DML 操作遵循 ACID 模型,事务支持提交、回滚和崩溃恢复功能,以保护用户数据。请参见 第 17.2 节,“InnoDB 和 ACID 模型”。Its DML operations follow the ACID model, with transactions featuring commit, rollback, and crash-recovery capabilities to protect user data. See Section 17.2, “InnoDB and the ACID Model”.
行级锁定和 Oracle 风格的一致性读取提高了多用户并发性和性能。请参见 第 17.7 节,“InnoDB 锁定和事务模型”。Row-level locking and Oracle-style consistent reads increase multi-user concurrency and performance. See Section 17.7, “InnoDB Locking and Transaction Model”.
InnoDB表在磁盘上组织数据以优化基于主键的查询。每个InnoDB表都有一个称为聚簇索引的主键索引,用于组织数据以最小化主键查找的 I/O。参见 第 17.6.2.1 节,“聚簇和二级索引”。InnoDBtables arrange your data on disk to optimize queries based on primary keys. EachInnoDBtable has a primary key index called the clustered index that organizes the data to minimize I/O for primary key lookups. See Section 17.6.2.1, “Clustered and Secondary Indexes”.为了维护数据完整性,
InnoDB支持FOREIGN KEY约束。通过外键,插入、更新和删除操作会进行检查,以确保不会导致相关表之间的不一致。参见 第 15.1.20.5 节,“FOREIGN KEY 约束”。To maintain data integrity,InnoDBsupportsFOREIGN KEYconstraints. With foreign keys, inserts, updates, and deletes are checked to ensure they do not result in inconsistencies across related tables. See Section 15.1.20.5, “FOREIGN KEY Constraints”.
表 17.1 InnoDB 存储引擎功能Table 17.1 InnoDB Storage Engine Features
| 功能Feature | 支持情况Support |
|---|---|
| B 树索引B-tree indexes | 是Yes |
| 备份/时间点恢复(在服务器中实现,而非在存储引擎中实现。)Backup/point-in-time recovery (Implemented in the server, rather than in the storage engine.) | 是Yes |
| 集群数据库支持Cluster database support | 否No |
| 聚簇索引Clustered indexes | 是Yes |
| 压缩数据Compressed data | 是Yes |
| 数据缓存Data caches | 是Yes |
| 加密数据Encrypted data | 是(通过加密功能在服务器中实现;在 MySQL 5.7 及以后版本,支持静态数据加密。)Yes (Implemented in the server via encryption functions; In MySQL 5.7 and later, data-at-rest encryption is supported.) |
| 外键支持Foreign key support | 是Yes |
| 全文搜索索引Full-text search indexes | 是(MySQL 5.6 及以后版本支持 FULLTEXT 索引。)Yes (Support for FULLTEXT indexes is available in MySQL 5.6 and later.) |
| 地理空间数据类型支持Geospatial data type support | 是Yes |
| 地理空间索引支持Geospatial indexing support | 是(MySQL 5.7 及以后版本支持地理空间索引。)Yes (Support for geospatial indexing is available in MySQL 5.7 and later.) |
| 哈希索引Hash indexes | 否(InnoDB 内部使用哈希索引来实现自适应哈希索引功能。)No (InnoDB utilizes hash indexes internally for its Adaptive Hash Index feature.) |
| 索引缓存Index caches | 是Yes |
| 锁粒度Locking granularity | 行Row |
| 多版本并发控制 (MVCC)MVCC | 是Yes |
| 复制支持(在服务器中实现,而不是在存储引擎中。)Replication support (Implemented in the server, rather than in the storage engine.) | 是Yes |
| 存储限制Storage limits | 64TB |
| T 树索引T-tree indexes | 否No |
| 事务Transactions | 是Yes |
| 更新数据字典统计信息Update statistics for data dictionary | 是Yes |
要比较InnoDB与 MySQL 提供的其他存储引擎的特性,请参见存储引擎特性表格,位于第 18 章,替代存储引擎.To compare the features of InnoDB with other
storage engines provided with MySQL, see the Storage
Engine Features table in
Chapter 18, Alternative Storage Engines.
InnoDB 增强功能和新特性InnoDB Enhancements and New Features
有关 InnoDB 增强功能和新特性的详细信息,请参阅:For information about InnoDB enhancements and new
features, refer to:
在 第 1.4 节,“自 MySQL 8.0 以来 MySQL 8.4 的新特性” 中的
InnoDB增强列表。TheInnoDBenhancements list in Section 1.4, “What Is New in MySQL 8.4 since MySQL 8.0”.发行说明。The Release Notes.
额外的 InnoDB 信息和资源Additional InnoDB Information and Resources
有关
InnoDB相关术语和定义,请参见 MySQL 词汇表。ForInnoDB-related terms and definitions, see the MySQL Glossary.有关专门针对
InnoDB存储引擎的论坛,请参见 MySQL 论坛::InnoDB。For a forum dedicated to theInnoDBstorage engine, see MySQL Forums::InnoDB.InnoDB是根据与 MySQL 相同的 GNU GPL 第 2 版许可证(1991 年 6 月)发布的。有关 MySQL 许可的更多信息,请参见 http://www.mysql.com/company/legal/licensing/。InnoDBis published under the same GNU GPL License Version 2 (of June 1991) as MySQL. For more information on MySQL licensing, see http://www.mysql.com/company/legal/licensing/.