我正在使用日志错误将警告/错误写入文件。当我执行 INSERT IGNORE..SELECT 语句时,它只是继续写入此警告消息。
120905 3:01:23 [Warning] Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT IGNORE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave.
我想阻止 mysql logwriter 一遍又一遍地写上面的错误。 (我看不到其他日志,因为它们填写了整个日志文件......)
首先,我将 (a, b, c) 插入表中。 c在表中应该是唯一的,a、b用于选择。查询将是这样的
SELECT c FROM table WHERE a=value1 AND value2<b AND b<value3
我的插入查询是
INSERT IGNORE INTO table VALUES (,,),(,,)...(,,)
我认为我可以更改查询以不产生警告,但我的数据包含唯一字段,我需要保证该字段在表中是唯一的。每隔几秒就需要插入500~2000行,所以我需要进行批量插入。
如果已经插入了几百万行,我需要在几秒钟内再插入 2000 行。如何将它们安全地插入表中而不用警告填充日志文件?
(我无法关闭二进制日志,因为我需要使用mysql复制。)