Spec-Zone .ru
спецификации, руководства, описания, API
|
Historically, all InnoDB
tables and indexes were stored in the system
tablespace. This monolithic approach was targeted at machines dedicated entirely to database processing,
with carefully planned data growth, where any disk storage allocated to MySQL would never be needed for other
purposes. InnoDB
's file-per-table mode is a more
flexible alternative, where you store each InnoDB
table and its indexes in a
separate file. Each such .ibd
file represents a separate tablespace. This
mode is controlled by the innodb_file_per_table
configuration option, and is the default in MySQL 5.6.6
and higher.
Multiple tablespaces are useful in a number of situations:
You can reclaim disk space when truncating or dropping a table. For tables created
when file-per-table mode is turned off, truncating or dropping them creates free space internally in the
ibdata files. That free
space can only be used for new InnoDB
data.
You can store specific tables on separate storage devices, for I/O optimization,
space management, or backup purposes. In previous releases, you had to move entire database directories
to other drives and create symbolic links in the MySQL data directory, as described in Section
8.11.3.1, "Using Symbolic Links". In MySQL 5.6 and higher, you can specify the location of each
table using the syntax CREATE TABLE ... DATA DIRECTORY =
, as explained in Section 5.4.1.2, "Specifying the
Location of a Tablespace". absolute_path_to_directory
You can copy individual InnoDB
tables from one MySQL
instance to another (known as the transportable tablespace
feature).
You can enable compression for table and index data, using the compressed row format.
You can enable more efficient storage for tables with large BLOB or text columns using the dynamic row format.
You can back up or restore a single table quickly, without interrupting the use of
other InnoDB
tables, using the MySQL Enterprise Backup product. See .ibd
File