简体   繁体   English

慢速查询占用整个硬盘空间,导致“1030来自存储引擎的错误28”

[英]Slow query takes up entire HDD space resulting in a “1030 Got error 28 from storage engine”

Fairly new to MySQL. 相当新的MySQL。

Slow query takes up the entire HDD space ending up with 1030 error code. 慢查询占用整个硬盘空间,最终得到1030错误代码。

INSERT INTO schema.Table C
SELECT a.`Date`, a.Store, a.SKU, 
       floor((a.QTY / ((b.CASEQTY * b.CASEPERLAYER) * b.LAYERPERPALLET))) AS Pallets,
       floor(((a.QTY / ((b.CASEPERLAYER * b.LAYERPERPALLET) * b.CASEQTY)) /.CASEQTY)) AS Cases,
       (a.QTY * b.CASEQTY) AS Pieces
FROM
    (schema.table1 AS a
    INNER JOIN schema.table2 AS b)
    WHERE a.Description = 'BLAH';

Problem: 问题:

When I run the above query I get the results I need in 0.01 sec with a limit of 100 rows. 当我运行上面的查询时,我得到了我需要的结果,在0.01秒内限制为100行。 However, When I try to insert the query into a prepared table it fails. 但是,当我尝试将查询插入准备好的表时,它会失败。

The above query will basically run for hours until the HDD is full. 上述查询基本上会运行几个小时,直到硬盘满了。 Table A contains millions of records and table B only a few thousand. 表A包含数百万条记录,表B仅包含数千条记录。 Storage engine is InnoDB. 存储引擎是InnoDB。 I've run a similar query for 3hrs and have had it succeed. 我已经运行了3小时的类似查询并且已经成功了。 Any help will be greatly appreciated. 任何帮助将不胜感激。

That's something special in MySQL. 这在MySQL中很特别。 In spite of calling it INNER JOIN , you can do a CROSS JOIN by leaving out the ON clause which is exactly what you are doing. 尽管将其称为INNER JOIN ,但您可以通过省略ON子句来执行CROSS JOIN ,这正是您正在执行的操作。 (Another dbms would raise a syntax error.) (另一个dbms会引发语法错误。)

So by not specifying the ON clause to match records from table1 and table2 you match every record in table1 with every record in table2. 因此,通过不指定ON子句,匹配从表1的记录和表2你在表2 每个记录在表1 每个记录相匹配。 These can be many :-) 这可能很多:-)

Your inner join statement contains no join criteria. 您的内部联接语句不包含联接条件。 This will result in something (bad) called a "cartesian product". 这将导致一些(坏的)称为“笛卡尔积”。 So, if table A has a million records and table b contains a thousand, then a cartesian product will match each row in table A to EVERY row in the other table. 因此,如果表A有一百万条记录而表b包含一千条,那么笛卡尔积将匹配表A中的每一行到另一个表中的每一行。 This should give you (at least) a billion records. 这应该给你(至少)十亿条记录。

To fix this, you need to define/constrain the relationship between the two tables by using an "ON" clause for your join or it could go in the WHERE clause. 要解决此问题,您需要通过对连接使用“ON”子句来定义/约束两个表之间的关系,或者它可以放在WHERE子句中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 1030 从存储引擎得到错误 28 - 1030 Got error 28 from storage engine mysqldump:无法执行'show fields from'':从存储引擎获得错误28(1030) - mysqldump: Couldn't execute 'show fields from `': Got error 28 from storage engine (1030) MySQL错误:“ 1030-从存储引擎收到错误-1” - MySQL error: “1030 - Got error -1 from storage engine” 第 25 行的 ERROR 1030 (HY000):来自存储引擎的错误 168 - ERROR 1030 (HY000) at line 25: Got error 168 from storage engine 解决“错误代码:1030。从存储引擎 MEMORY 收到错误 1“不允许操作”” - Resolve 'Error Code: 1030. Got error 1 “Operation not permitted” from storage engine MEMORY' 由于mysql错误,Magento网站关闭常规错误:1030从存储引擎获取错误-1 - Magento site down due to mysql error General error: 1030 Got error -1 from storage engine #1030 - 从存储引擎 Aria 得到错误 176“读取校验和错误的页面” - #1030 - Got error 176 "Read page with wrong checksum" from storage engine Aria AWS MySql RDS:“存储引擎出现错误28” - AWS MySql RDS: “Got error 28 from storage engine” Docker MySQL 容器错误 1030(HY000):得到错误 168 - 来自存储引擎的“来自引擎的未知(通用)错误” - Docker MySQL container ERROR 1030 (HY000): Got error 168 - 'Unknown (generic) error from engine' from storage engine MySQL 错误代码:1030 来自存储引擎的错误 -1; 我试图从我的数据库中删除数据 - MySQL Error Code: 1030Got error -1 from storage engine; I've tried to delete data from my database
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM