admin管理员组文章数量:1383168
Following the discussion here: MySQL 8: very slow INSERT…SELECT within the same server for huge partitioned table
We started to update our tables to the new indexes. Since downtime longer than a minute is not acceptable due to the nature of the system, we’re doing it by copying data from the old table into the new one (meanwhile new data is inserted into the old table).
There’re several servers with slightly different MySQL versions and hardware. Two servers have been successfully moved to using the new table by now. But the third one got problematic: as soon as we run
INSERT INTO `new_messages` SELECT * FROM `messages` WHERE `ID` BETWEEN @N1 AND @N2;
the software that inserts live data into the source table (through a stored procedure that does a few checks and INSERTs a row into the messages
table) just freezes. When the copying query finishes, it unfreezes and proceeds running normally.
The failing server has MySQL 8.0.35 while the previous ones run 8.0.20. I’ve manually checked system variables and they basically seem to have the same or similar values. The hardware might be somewhat different but has nearly the same characteristics in general.
One thing that worried me at the very beginning is the number of INSERTs/s in SHOW ENGINE INNODB STATUS
: the failing server has it nearly about 6000/s average, which is 2 and 5 times less than the two servers that moved successfully, but that’s still quite a lot as live data arrives at only around 50 messages/s.
Dumping the whole table (hundreds of millions of records) is too long a downtime. Using smaller chunks wouldn’t really change much: if run without delays in between, that’s the same long freeze for the whole system, with delays it might take forever.
TL;DR: INSERT INTO … SELECT
causes freeze for normal INSERT
queries on the source table on one server but not others. A bit different hardware, a bit different versions of MySQL, nearly the same configuration.
I appreciate any suggestions on how to detect the cause of the problem as well as some theories on what could be wrong.
本文标签: MySQL INSERT INTO SELECT freezes INSERTs into source tableStack Overflow
版权声明:本文标题:MySQL: INSERT INTO SELECT freezes INSERTs into source table - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743985088a2571242.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论