Optimizing tables
Database tables are the most basic building blocks for any database. In this section of the chapter, we will focus on optimizing tables. The section provides detailed guidelines for improving performance through table optimization techniques.
Optimization for InnoDB tables
The InnoDB
storage engine is preferred in production environments in situations where reliability and concurrency are important. It is the default storage engine for MySQL tables. This section focuses on optimizing database operations for InnoDB
tables.
The following are the guidelines to optimize InnoDB
tables:
- Use of the
OPTIMIZE TABLE
statement should be considered to reorganize the table and compact the wasted space once the data reaches a stable size or the table has increased by tens of megabytes. It requires less disk I/O to perform full table scans for reorganized tables. - The
OPTIMIZE TABLE
statement copies the data in the table and rebuilds the indexes. It is beneficial because of improved packing...