MySQL会话临时表空间有什么作用
更新:HHH   时间:2023-1-7


本文主要给大家介绍MySQL会话临时表空间有什么作用,文章内容都是笔者用心摘选和编辑的,具有一定的针对性,对大家的参考意义还是比较大的,下面跟笔者一起了解下MySQL会话临时表空间有什么作用吧。                                                          

1、物理文件
[root@roidb1 data]# cd \#innodb_temp/
[root@roidb1 #innodb_temp]# ls -lh
total 160K
-rw-r-----. 1 mysql mysql 80K Nov 22 18:58 temp_10.ibt
-rw-r-----. 1 mysql mysql 80K Nov 22 18:58 temp_1.ibt
-rw-r-----. 1 mysql mysql 80K Nov 22 18:58 temp_2.ibt
-rw-r-----. 1 mysql mysql 80K Nov 22 18:58 temp_3.ibt
-rw-r-----. 1 mysql mysql 80K Nov 22 18:58 temp_4.ibt
-rw-r-----. 1 mysql mysql 80K Nov 22 18:58 temp_5.ibt
-rw-r-----. 1 mysql mysql 80K Nov 22 18:58 temp_6.ibt
-rw-r-----. 1 mysql mysql 80K Nov 22 18:58 temp_7.ibt
-rw-r-----. 1 mysql mysql 80K Nov 22 18:58 temp_8.ibt
-rw-r-----. 1 mysql mysql 80K Nov 22 18:58 temp_9.ibt
[root@roidb1 #innodb_temp]# 
2、临时表空间目录
mysql> show variables like 'innodb_temp_tablespaces_dir';
+-----------------------------+-----------------+
| Variable_name               | Value           |
+-----------------------------+-----------------+
| innodb_temp_tablespaces_dir | ./#innodb_temp/ |
+-----------------------------+-----------------+
1 row in set (0.00 sec)

使用了新的版本MySQL8.0.18,有很多地方和MySQL5.7有很大的区别。
Defines the location where InnoDB creates a pool of session temporary tablespaces at startup. The default location is the #innodb_temp directory in the data directory. A fully qualified path or path relative to the data directory is permitted.
说明:定义了创建临时表空间池的位置。默认位置为#innodb_temp目录。

As of MySQL 8.0.16, session temporary tablespaces always store user-created temporary tables and internal temporary tables created by the optimizer using InnoDB. (Previously, the on-disk storage engine for internal temporary tables was determined by the internal_tmp_disk_storage_engine system variable, which is no longer supported.
说明:从MySQL8.0.16版本以后,会话临时表空间总是存储创建用户临时表和

内部临时表。

看完以上关于MySQL会话临时表空间有什么作用,很多读者朋友肯定多少有一定的了解,如需获取更多的行业知识信息 ,可以持续关注我们的行业资讯栏目的。

返回MySQL数据库教程...