参见:http://dev.mysql.com/doc/refman/5.5/en/innodb-multiple-tablespaces.html
By default, all InnoDB tables and indexes are stored in the system tablespace. As an alternative, you can store each InnoDB
table and its indexes in its own file. This feature is called “multiple tablespaces” because each table that is created when this setting is in effect has its own tablespace.
Advantages of Per-Table Tablespaces
-
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. -
The
TRUNCATE TABLE
operation is faster when run on individual.ibd
files. -
You can store specific tables on separate storage devices, for I/O optimization, space management, or backup purposes.
-
You can run
OPTIMIZE TABLE
to compact or recreate a tablespace. When you run anOPTIMIZE TABLE
,InnoDB
will create a new.ibd
file with a temporary name, using only the space required to store actual data. When the optimization is complete,InnoDB
removes the old.ibd
file and replaces it with the new.ibd
file. If the previous.ibd
file had grown significantly but actual data only accounted for a portion of its size, runningOPTIMIZE TABLE
allows you to reclaim the unused space. -
You can move individual
InnoDB
tables rather than entire databases. -
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 Backing Up and Restoring a Single.ibd
File for the procedure and restrictions. -
If
innodb_file_per_table
is disabled, there is one shared tablespace (the system tablespace) for tables, the data dictionary, and undo logs. This single tablespace has a 64TB size limit. Ifinnodb_file_per_table
is enabled, each table has its own tablespace, each with a 64TB size limit. See Section E.10.3, “Limits on Table Size”for related information.
Enabling and Disabling Multiple Tablespaces
To enable multiple tablespaces, start the server with the --innodb_file_per_table
option. For example, add a line to the [mysqld]
section of my.cnf
:
[mysqld] innodb_file_per_table
With multiple tablespaces enabled, InnoDB
stores each newly created table in its own
file in the appropriate database directory. Unlike the tbl_name
.ibdMyISAM
storage engine, with its separate
andtbl_name
.MYD
files for indexes and data, tbl_name
.MYIInnoDB
stores the data and the indexes together in a single .ibd
file. The
file is still created as usual.tbl_name
.frm
InnoDB
always needs the shared tablespace because it puts its internal data dictionary and undo logs there. The.ibd
files are not sufficient for InnoDB
to operate.
When a table is moved out of the system tablespace into its own .ibd
file, the data files that make up the system tablespace remain the same size. The space formerly occupied by the table can be reused for new InnoDB
data, but is not reclaimed for use by the operating system. When moving large InnoDB
tables out of the system tablespace, where disk space is limited, you might prefer to turn on innodb_file_per_table
and then recreate the entire instance using the mysqldump command.(Innodb table这样使用起来非常不方便)
相关推荐
4. **数据模型**:MySQL Cluster使用表空间(Tablespaces)来组织数据,每个表空间可以在多个数据节点上分布。 5. **性能优化**:包括调整参数如`max_connections`、`chunk_size`和`data_memory`等,以适应不同的...
3. 创建 MySQL 数据文件目录并初始化数据库:mysqld --initialize --user=mysql --basedir=/data/mysql --datadir=/data/mysql/data --lower-case-table-names=1 --socket=/data/mysql/mysql.sock 4. 记录自动生成的...
# bin/mysqld --initialize --user=mysql --basedir=/data/mysql --datadir=/data/mysql/data --innodb_undo_tablespaces=3 --explicit_defaults_for_timestamp ``` - `--innodb_undo_tablespaces`参数用于设定...
本篇文章将深入探讨MySQL的备份与恢复策略,包括常见的工具和参数,特别是对`mysqldump`工具的详细使用。 1. **mysqldump**:这是MySQL的逻辑备份工具,通过SQL语句生成数据的脚本文件。它适用于不同MySQL版本之间...
Chapter 2, Using MySQL, takes you through the basic uses of MySQL, such as creating databases and tables; inserting, updating, deleting, and selecting data in various ways; saving to different ...
- **Documentation (文档)**: MySQL 的官方文档。 - **Server Data Files (服务器数据文件)**: 存储 MySQL 数据库的数据文件。 - **Debug Symbols (调试符号)**: 用于调试 MySQL 服务器的符号文件。 - 通过点击...
### 22.25 The INFORMATION_SCHEMA TABLESPACES Table 该表提供了表空间的相关信息,包括表空间名称、文件路径等。这对于优化存储布局和管理空间使用非常重要。 ### 22.26 The INFORMATION_SCHEMA TABLE_...
### DB2 使用手册知识点详解 #### 一、DB2 基础操作 **1. 创建数据库** - **语法**: `CREATE DATABASE <数据库名称> ON G: ALIAS <别名> USING CODESET <字符集> TERRITORY CN COLLATE USING SYSTEM DFT_EXTENT_...
- `--add-drop-table`: 在每个表创建前添加DROP TABLE语句,默认开启。 - `--add-locks`: 在每个表导出前增加LOCK TABLES和UNLOCK TABLES语句,默认开启。 - `--comments`: 附加注释信息,默认开启,可使用`--skip-...
首先,InnoDB存储空间主要由表空间(Tablespaces)组成,包括系统表空间(System Tablespace)和独立表空间(Single-Table Tablespaces)。系统表空间包含了所有数据库对象,如表、索引等,而独立表空间则允许每个表...
MySQL 5.7 参考手册是MySQL数据库系统的核心文档,涵盖了从5.7.0到5.7.39的版本,同时包括基于NDB 7.5版本的NDB集群直至5.7.37-ndb-7.5.26。手册可能包含还未发布的MySQL版本特性。要了解已发布的具体版本信息,可以...
Oracle 提供了多种类型的表空间,包括 System tablespaces、Non-system tablespaces、Online tablespaces、Offline tablespaces、Read-Write tablespaces、Read-Only tablespaces、Transportable tablespaces 等。...
Using Optimal Flexible Architecture 2-9 Setting Environment Variables 2-11 Oracle Universal Installer (OUI) 2-13 Installing the Oracle Software 2-14 Database Configuration Options 2-15 iii Oracle ...
scripts/mysql_install_db --user=mysql --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/mysql/data --innodb_undo_tablespaces=3 --explicit_defaults_for_timestamp ``` 更改数据目录和MySQL...
### IBM DB2 常用命令集合解析 #### 一、数据库创建与管理 ##### 1.... - **命令格式**: ```sql CREATE DATABASE <database_name> ON <node_name> USING ... LIST TABLESPACES; ``` - **示例**:列出所有表空间...
Oracle数据库DBA(Database Administrator)管理手册是数据库管理员学习和参考的重要资料,1-3章通常涵盖了Oracle数据库的基础知识和核心管理概念。以下是对这些章节的详细解释: 1. **Oracle数据库简介** - ...
### MySQL DBA性能调优全攻略 #### 一、引言 在当今信息化时代,数据库作为数据管理和存储的核心工具,在企业应用中扮演着至关重要的角色。MySQL作为一种广泛使用的开源关系型数据库管理系统,其性能调优成为了提高...
本《DBA日常维护工作手册参考》旨在降低Oracle数据库的现场实施和管理难度,提高数据库技术能力。文档针对Oracle9i、10g两个版本,提供了监控、管理的完整思路和步骤。遵循手册执行日常任务,可以有效确保Oracle...
根据给定的信息,我们可以归纳出以下关于Java、Oracle与MySQL数据库配置的相关知识点: ### 一、数据库驱动配置 #### 1. **SQL Server 配置** - **JTDs (Java to Data Source)**: 一种开源的 JDBC 驱动程序,用于...