诡异的临时表问题,跟大家分享一下,求问题症结所在!

[复制链接]
查看11 | 回复9 | 2013-12-18 09:29:09 | 显示全部楼层 |阅读模式
MySQL error报错日志如下:
1205274:10:04 [Warning] Invalid (old?) table or database name '#sql7a34_79ddae_2'
1205274:10:04 [Warning] Invalid (old?) table or database name '#sql7a34_79ddae_2'
1205274:10:04 [Warning] Invalid (old?) table or database name '#sql7a34_79ddae_2'
1205274:10:04 [Warning] Invalid (old?) table or database name '#sql7a34_79ddae_2'
1205274:10:04 [Warning] Invalid (old?) table or database name '#sql7a34_79ddae_2'
1205274:10:04 [Warning] Invalid (old?) table or database name '#sql7a34_79ddae_2'
1205274:10:04 [Warning] Invalid (old?) table or database name '#sql7a34_79ddae_2'
1205274:10:04 [Warning] Invalid (old?) table or database name '#sql7a34_79ddae_2'
1205276:10:04 [Warning] Invalid (old?) table or database name '#sql7a34_7ea296_2'
1205276:10:04 [Warning] Invalid (old?) table or database name '#sql7a34_7ea296_2'
1205276:10:04 [Warning] Invalid (old?) table or database name '#sql7a34_7ea296_2'
1205276:10:04 [Warning] Invalid (old?) table or database name '#sql7a34_7ea296_2'
1205276:10:04 [Warning] Invalid (old?) table or database name '#sql7a34_7ea296_2'
1205276:10:04 [Warning] Invalid (old?) table or database name '#sql7a34_7ea296_2'
1205276:10:04 [Warning] Invalid (old?) table or database name '#sql7a34_7ea296_2'
1205276:10:04 [Warning] Invalid (old?) table or database name '#sql7a34_7ea296_2'

回复

使用道具 举报

千问 | 2013-12-18 09:29:09 | 显示全部楼层
本帖最后由 mchdba 于 2012-5-28 11:44 编辑
自己写了一个脚本,抓到这2个时间点执行sql如下:

$sql = "insert into product_xxxxxxx(select * from product_inventory_xxxxxxx)";
product_inventory_xxxxxxx这个是临时表;
在insert之前有如下sql:
1CREATE TEMPORARY TABLE `product_inventory_xxxxxxx` ".$table_structure;
2然后是一堆insert,upate,大概有15条左右吧。
3insert into product_xxxxxxx(select * from product_inventory_xxxxxxx)";
在1和2的时候,没有报错,在3的时候报错了,而且报错之后3还在执行,大概需要70秒执行完毕。

回复

使用道具 举报

千问 | 2013-12-18 09:29:09 | 显示全部楼层
典型的临时空间满了,以前遇到过!你有没有抓住当时临时空间的而使用率呢??
回复

使用道具 举报

千问 | 2013-12-18 09:29:09 | 显示全部楼层
kerlion 发表于 2012-5-28 12:32
典型的临时空间满了,以前遇到过!你有没有抓住当时临时空间的而使用率呢??

看参数
mysql> show variables like '%tmp_table_size%';
+----------------+------------+
| Variable_name| Value|
+----------------+------------+
| tmp_table_size | 4294967296 |
+----------------+------------+
1 row in set (0.00 sec)
mysql> show variables like '%max_heap_table_size%';

+---------------------+------------+
| Variable_name | Value|
+---------------------+------------+
| max_heap_table_size | 4294967296 |
+---------------------+------------+
1 row in set (0.00 sec)

都设置成了4个G了,还不够吗?
回复

使用道具 举报

千问 | 2013-12-18 09:29:09 | 显示全部楼层
kerlion 发表于 2012-5-28 12:32
典型的临时空间满了,以前遇到过!你有没有抓住当时临时空间的而使用率呢??

另外查了网上资料,如果临时表空间满了,应该报“table is full”之类的错误吧!
回复

使用道具 举报

千问 | 2013-12-18 09:29:09 | 显示全部楼层
暂时将配置全部扩大一倍,试试看效果吧:
mysql> set global tmp_table_size=8589934592;
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> set global max_tmp_tables=64;
Query OK, 0 rows affected (0.00 sec)

回复

使用道具 举报

千问 | 2013-12-18 09:29:09 | 显示全部楼层
支持,等结果
回复

使用道具 举报

千问 | 2013-12-18 09:29:09 | 显示全部楼层
你找个测试机测试下,到底报什么错?
我上次测试百万行数据,就用光了12G的空间
回复

使用道具 举报

千问 | 2013-12-18 09:29:09 | 显示全部楼层
kerlion 发表于 2012-5-28 15:43
你找个测试机测试下,到底报什么错?
我上次测试百万行数据,就用光了12G的空间

测试机上从来没有报错,所以很诡异的问题啦!
回复

使用道具 举报

千问 | 2013-12-18 09:29:09 | 显示全部楼层
水洒了 发表于 2012-5-28 14:28
支持,等结果

昨天改了参数,增大了一倍,但是还是一样的报错,看来不是临时表空间的参数太小的缘故吧!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行