mysql 查询:表的密钥文件不正确
我运行这个查询:
SELECT v.autor, v.titlu, 'http://85.25.176.18/resursecrestine-download' + v.`link`
FROM `video_resurse` v, predicimp3 p
WHERE v.titlu = p.titlu
ORDER BY v.autor
一切都好。
但是当我用“!=”替换“=”时,它需要很长时间......而不是结果,它给了我:
#126 - Incorrect key file for table '/tmp/#sql_42c5_0.MYI'; try to repair it
为什么?
I run this query:
SELECT v.autor, v.titlu, 'http://85.25.176.18/resursecrestine-download' + v.`link`
FROM `video_resurse` v, predicimp3 p
WHERE v.titlu = p.titlu
ORDER BY v.autor
all it's ok.
But when I replace "=" with "!=" it takes very long...and instead of results it gives me:
#126 - Incorrect key file for table '/tmp/#sql_42c5_0.MYI'; try to repair it
Why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
You equal 是一个联接,它通常返回相当小的一组内容。如果将 = 替换为 !=,则将强制数据库执行 CROSS JOIN,然后进行过滤以排除任何相等的记录。
要进行交叉连接,数据库可能需要创建一个临时表,其总行数等于(video_resurse 中的行数)*(predicimp3 中的行数)。如果这些表中的任何一个包含大量行,则临时表可能会非常大并且需要很长时间才能生成。因此性能缓慢。
您看到的错误可能表明您在 /tmp 目录(mysql 默认情况下放置临时表的位置)中运行了我们的空间,这可能会导致该错误。
You equal is a join, which typically returns a fairly small set of things. If you replace the = with !=, your are forcing the DB to do a CROSS JOIN and then filter through that to exclude any records that are equal.
To do the CROSS JOIN the DB probably needs to make a temp table with a total number of rows equal to (number of rows in video_resurse) * (number of rows in predicimp3). If either of those tables has a large number of rows in it, then the temp table is likely to be very large and take a long time to generate. Hence the slow performance.
The error you are seeing is likely indicating that you ran our of space in the /tmp directory (which is where mysql puts its temp tables by default) which can cause that error.