日期:2014-05-16  浏览次数:20986 次

求帮助,查询视图报#sql_63e3_0.MYI错误
错误如下:err日志:120807 11:31:20 [ERROR] /usr/local/mysql/libexec/mysqld: Incorrect key file for table '/dev/shm/mysql_tmp/#sql_63e3_0.MYI'; try to repair it
查询后报错截图:
  


具体操作:
select * from v_user where (uniqid REGEXP '[[:alnum:]]+') and cast(create_time as date) ='20120808'

其他相关:
v_user是一个视图,由多个user分表union,且各个user分表均没有损坏,user分表的引擎为innodb
视图中的查询语句如下:

select * from user_1 union all select * from user_2 union all select * from user_3 union all select * from user_4 union all select * from user_5 union all select * from user_5 union all select * from user_6 union all select * from user_7 union all select * from user_8  

表没有损坏,索引也是正常,临时表空间设置3G,使用的是centos5.5 64位系统,每张表有40万的数据量,这样的数据量其实也不算多,单独执行视图中的语句也会报这个错。有什么办法可以解决或是优化
求热心人士帮助

------解决方案--------------------
检查你的磁盘空间还有多少。
------解决方案--------------------
不要在时间字段上加函数
where cast(create_time as date) ='20120808'

改成

where create_time>'20120808' and create_time<'20120809';