MySQL 8.0.23 tmp 表不断填满

问题描述

我在使用旧版本的 MysqL 时没有遇到过这个问题,包括我在 AWS RDS 中在生产环境中运行的最高 8.0.21。我有一个一年只运行一次的查询。相关代码如下:

create table medicare_fee_history (
        year int unsigned,mac int unsigned,locality int unsigned,hcpcs varchar(10),modifier varchar(10),index (mac,locality,hcpcs,modifier),non_facility decimal(17,4),facility decimal(17,4)
) engine = myisam;

load data local infile 'PFALL.csv'
into table medicare_fee_history
fields terminated by ',' enclosed by '"'
(year,mac,modifier,non_facility,facility);

create table medicare_fee_first (
        year int unsigned,index (hcpcs,4)
) engine = myisam;

insert into medicare_fee_first (year,facility,non_facility)
(
        select min(year),avg(facility),avg(non_facility)
        from medicare_fee_history group by hcpcs,modifier
);

在插入选择期间,我收到以下错误

错误 1114 (HY000):表 '/tmp/#sql4984_9_3' 已满

medicare_fee_history 表有 16042724 行。为了重现这一点,数据集可以在 https://drive.google.com/file/d/1p7Yf7wsCnBXl7UaxeFC1AP0youl-KCdZ/view?usp=sharing

查询一般返回 10823 行。如果您消除 avg(facility) 和 avg(non_facility) 它似乎工作。 /tmp 中有足够的空间。 100G 的 92% 是免费的。我将 tmp_table_size 设置为最大值。以下是当前的服务器设置:

MysqL> show variables like '%tmp%';
+---------------------------------+----------------------+
| Variable_name                   | Value                |
+---------------------------------+----------------------+
| default_tmp_storage_engine      | InnoDB               |
| innodb_tmpdir                   |                      |
| internal_tmp_mem_storage_engine | TempTable            |
| slave_load_tmpdir               | /tmp                 |
| tmp_table_size                  | 18446744073709551615 |
| tmpdir                          | /tmp                 |
+---------------------------------+----------------------+
6 rows in set (0.00 sec)

MysqL> show variables like '%temp%';
+-----------------------------+-----------------------+
| Variable_name               | Value                 |
+-----------------------------+-----------------------+
| avoid_temporal_upgrade      | OFF                   |
| innodb_temp_data_file_path  | ibtmp1:12M:autoextend |
| innodb_temp_tablespaces_dir | ./#innodb_temp/       |
| show_old_temporals          | OFF                   |
| temptable_max_mmap          | 1073741824            |
| temptable_max_ram           | 1073741824            |
| temptable_use_mmap          | ON                    |
+-----------------------------+-----------------------+
7 rows in set (0.00 sec)

有关如何解决此问题的任何想法?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)