Below is my MySQL Server's status and configuration. But I can not see anything under /tmpfs/, it is showing empty to me. here is the result of "ls -al" drwxrwxrwx 2 mysql mysql 60 Apr 7 17:43 tmpfs Could anyone tell me how to check the status of temp files and temp tables
on disk?
---- mysql> SHOW global STATUS LIKE 'created_tmp%'; +-------------------------+-------+ | Variable_name | Value | +-------------------------+-------+ | Created_tmp_disk_tables | 4682 | | Created_tmp_files | 291 | | Created_tmp_tables | 10997 | +-------------------------+-------+ mysql> SHOW variables LIKE '%tmp%'; +-------------------+----------+ | Variable_name | Value | +-------------------+----------+ | bdb_tmpdir | /tmpfs/ | | max_tmp_tables | 32 | | slave_load_tmpdir | /tmpfs/ | | tmp_table_size | 67108864 | | tmpdir | /tmpfs/ | +-------------------+----------+
+----------------------------+-----------------------+
| Variable_name | Value |
+----------------------------+-----------------------+
| avoid_temporal_upgrade | OFF |
| innodb_temp_data_file_path | ibtmp1:12M:autoextend |
| show_old_temporals | OFF |
+----------------------------+-----------------------+
3 rows in set (0.01 sec)
Where InnoDB Stores Temporary Files
As of MySQL 5.7.1, non-compressed InnoDB
temporary tables are stored in a temporary tablespace file named ibtmp1
, which is located in the MySQL data
directory (datadir
) by default. The innodb_temp_data_file_path
option can be used at startup to specify a different file name and location. Compressed InnoDB
temporary tables are stored in their own independent tablespace files (.ibd
files) in the path specified by the TMPDIR
environment variable.
If an ALTER TABLE
operation on an InnoDB
table uses the ALGORITHM=COPY
technique, InnoDB
creates a temporary copy of the table in the same directory as the original table. Temporary table file names begin with an #sql-
prefix and only appear briefly during the ALTER TABLE
operation.
If an ALTER TABLE
operation rebuilds an InnoDB
table using the ALGORITHM=INPLACE
technique (online DDL), InnoDB
creates an intermediate copy of the table the same directory as the original table. Intermediate table file names begin with an #sql-ib
prefix and only appear briefly during the ALTER TABLE
operation.
ALTER TABLE
operations that rebuild an InnoDB
table using the ALGORITHM=INPLACE
technique (online DDL) also create temporary sort files in the MySQL temporary directory ($TMPDIR
on Unix, %TEMP%
on Windows, or the directory specified by the --tmpdir
configuration option). If the temporary directory is not large enough to hold such files, you may need to reconfigure tmpdir
. Alternatively, you can define a separate temporary directory for InnoDB
online ALTER TABLE
operations using the innodb_tmpdir
configuration option. This option was introduced in MySQL 5.7.11 to help avoid temporary directory overflows that could occur as a result of large temporary sort files created during online ALTER TABLE
operations. innodb_tmpdir
can be configured dynamically using a SET GLOBAL
or SET SESSION
statement.
The innodb_tmpdir
option is not applicable to intermediate table files, which are always created in the same directory as the original table.
In replication environments, only consider replicating an innodb_tmpdir
setting if all servers have the same operating system environment. Otherwise, replicating an innodb_tmpdir
setting could result in a replication failure when running online ALTER TABLE
operations. If server operating environments differ, it is recommended that you configure innodb_tmpdir
on each server individually.