今天一个机器报警磁盘空间不足,上去看了下,直接100多G的error log,打开一看全是: 110423 21:06:57 [Warning] Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. Statement: delete from feed_content_10 where small_type=3514 and time <date_sub(now(),interval 15 day) order by time asc limit 400 这个是伟哥删过去数据时用的语句,以前语句没有order by time直接是limit 400出了一大堆warning,加了order by time之后居然warning依旧,google一把,原来也有人给mysql报了一个这样的[bug](http://bugs.mysql.com/bug.php?id=42415),使用order by之后删除的记录是完全确定的,按理不会出这个warning才对。 **仔细阅读发现蛋疼的事情出来了:**mysql把warning从this is unsafe改成了this may be unsafe,真蛋疼。 再往下看,用户又提说这个应该检测一下,不能语句中有个limit全报warning。mysql才增加了一个patch,不过现在还在等待review,review、测试完成之后应该会提交到正式版本中。(目前的percona5.5.10还没有更新) 目前解决这个问题两个方法:一个是将binlog_format换成row-based,一种是在更新语句中不使用limit。