官方文档: https://dev.mysql.com/doc/refman/5.7/en/internal-temporary-tables.html create table tb(id int , va varchar(10)); insert into tb(id, va) values (1, 'Created_tmp_disk_tables'); Some query conditions prevent the use of an in-memory temporary table, in which case the server uses an on-disk table instead: Presence of a BLOB or TEXT column in the table. This includes user-defined variables having a string value because they are treated as BLOB or TEXT columns, depending on whether their value is a binary or nonbinary string, respectively. # BLOB、TEXT列, 或者自定义变量被按BLOB、TEXT类型处理 alter table tb modify va text; select * from (select * from tb) t; Presence of any string column with a maximum length larger than 512 (bytes for binary strings, characters for nonbinary strings) in the SELECT list, if UNION or UNION ALL is used. # 列长度定义超过512,在union时 alter table tb modify va varchar(513); select * from tb union select * from tb; The SHOW COLUMNS and DESCRIBE statements use BLOB as the type for some columns, thus the temporary table used for the results is an on-disk table. # 查询表的列信息时。这个比较坑 SHOW columns from tb ; DESCRIBE tb;
查询结果集很小,但 Created_tmp_disk_tables 不断增加
来源:这里教程网
时间:2026-03-01 15:11:45
作者:
编辑推荐:
下一篇:
相关推荐
-
雷神推出 MIX PRO II 迷你主机:基于 Ultra 200H,玻璃上盖 + ARGB 灯效
2 月 9 日消息,雷神 (THUNDEROBOT) 现已宣布推出基于英
-
制造商 Musnap 推出彩色墨水屏电纸书 Ocean C:支持手写笔、第三方安卓应用
2 月 10 日消息,制造商 Musnap 现已在海外推出一款 Oce
热文推荐
- 批量远程桌面管理软件下载 vps服务器批量
批量远程桌面管理软件下载 vps服务器批量
26-03-01 - MySQL数据库锁应该这样用
MySQL数据库锁应该这样用
26-03-01 - MySQL 8.0 窗口函数-笔记
MySQL 8.0 窗口函数-笔记
26-03-01 - 电脑远程连接 vps群控
电脑远程连接 vps群控
26-03-01 - 全面梳理 简明安装指南 mysql 8 安装升级与配置
全面梳理 简明安装指南 mysql 8 安装升级与配置
26-03-01 - 批量远程桌面管理软件 批量管理服务器
批量远程桌面管理软件 批量管理服务器
26-03-01 - 5.5版本升级5.7.23SQL不兼容一例
5.5版本升级5.7.23SQL不兼容一例
26-03-01 - 批量远程登陆 批量管理服务器
批量远程登陆 批量管理服务器
26-03-01 - MySQL库表设计小技巧
MySQL库表设计小技巧
26-03-01 - 批量远程 批量管理服务器
批量远程 批量管理服务器
26-03-01
