innodb_file_per_table

PropertyValue
Command-Line Format--innodb-file-per-table
System Variableinnodb_file_per_table
ScopeGlobal
DynamicYes
Typeboolean
Default ValueON

When innodb_file_per_table is enabled (the default), InnoDB stores the data and indexes for each newly created table in a separate .ibd file instead of the system tablespace. The storage for these tables is reclaimed when the tables are dropped or truncated. This setting enables InnoDBfeatures such as table compression. SeeSection 14.7.4, “InnoDB File-Per-Table Tablespaces” for more information.

Enabling innodb_file_per_table also means that an ALTER TABLE operation moves an InnoDB table from the system tablespace to an individual .ibd file in cases where ALTER TABLE rebuilds the table (ALGORITHM=COPY). An exception to this rule is for tables placed in the system tablespace using the TABLESPACE=innodb_systemoption with CREATE TABLE or ALTER TABLE. These tables are unaffected by the innodb_file_per_table setting and can only be moved to file-per-table tablespaces using ALTER TABLE ... TABLESPACE=innodb_file_per_table.

When innodb_file_per_table is disabled, InnoDB stores the data for tables and indexes in the ibdata files that make up the system tablespace. This setting reduces the performance overhead of file system operations for operations such as DROP TABLE or TRUNCATE TABLE. It is most appropriate for a server environment where entire storage devices are devoted to MySQL data. Because the system tablespace never shrinks, and is shared across all databases in an instance, avoid loading huge amounts of temporary data on a space-constrained system when innodb_file_per_table is disabled. Set up a separate instance in such cases, so that you can drop the entire instance to reclaim the space.

innodb_file_per_table is enabled by default. Consider disabling it if backward compatibility with MySQL 5.5 or 5.1 is a concern. This will prevent ALTER TABLE from moving InnoDB tables from the system tablespace to individual .ibd files.

innodb_file_per_table is dynamic and can be set ON or OFF using SET GLOBAL. You can also set this option in the MySQL configuration file (my.cnf or my.ini) but this requires shutting down and restarting the server.

Dynamically changing the value requires the SUPER privilege and immediately affects the operation of all connections.

'DB TUNE' 카테고리의 다른 글

MySQL 현재 접속자 보기 및 MYSQL 모니터링 방법  (0) 2018.04.26
[MySQLD] Tunner  (0) 2018.04.19
MySQL 튜닝 값을 탐지해주는 유용한 툴  (0) 2018.04.19
[MySQLD] table_open_cache  (0) 2018.04.19
[MySQLD] join_buffer_size  (0) 2018.04.19

+ Recent posts