作为数据库管理员,您必须管理磁盘 I/O 以防止 I/O 子系统过载,并管理磁盘空间以避免存储设备被填满。ACID 设计模型需要一定量的 I/O,这可能看起来有些多余,但有助于确保数据可靠性。在这些约束条件下,InnoDB 会尝试优化数据库工作和磁盘文件的组织,以最小化磁盘 I/O 的数量。有时,I/O 会被延后,直到数据库不繁忙为止,或者直到需要将所有内容恢复到一致状态,例如在快速关闭后重启数据库期间。As a DBA, you must manage disk I/O to keep the I/O subsystem from
becoming saturated, and manage disk space to avoid filling up
storage devices. The ACID design
model requires a certain amount of I/O that might seem redundant,
but helps to ensure data reliability. Within these constraints,
InnoDB tries to optimize the database work and
the organization of disk files to minimize the amount of disk I/O.
Sometimes, I/O is postponed until the database is not busy, or until
everything needs to be brought to a consistent state, such as during
a database restart after a fast
shutdown.
本节讨论默认类型的 MySQL 表(也称为 InnoDB 表)的 I/O 和磁盘空间的主要考虑因素:This section discusses the main considerations for I/O and disk
space with the default kind of MySQL tables (also known as
InnoDB tables):
控制用于提高查询性能的后台 I/O 量。Controlling the amount of background I/O used to improve query performance.
启用或禁用以额外 I/O 为代价提供额外耐久性的功能。Enabling or disabling features that provide extra durability at the expense of additional I/O.
将表组织成许多小文件、几个大文件,或两者的组合。Organizing tables into many small files, a few larger files, or a combination of both.
在日志文件满时调整重做日志文件的大小与发生的 I/O 活动之间的平衡。Balancing the size of redo log files against the I/O activity that occurs when the log files become full.
如何重新组织表以获得最佳查询性能。How to reorganize a table for optimal query performance.