Miscellaneous Functions +-------------+ When  SLEEP()  is the only thing invoked by a query that is interrupted, it returns 1 and the query itself returns no error. This is true whether the query is killed or times out: •This statement is interrupted using  KILL QUERY  from another session: •This statement is interrupted by timing out: •This statement is interrupted using  KILL QUERY  from another session: •This statement is interrupted by timing out: 2450 mysql>  SELECT SLEEP(1000); +-------------+ | SLEEP(1000) | +-------------+ | 1 | +-------------+ mysql>  SELECT /*+ MAX_EXECUTION_TIME(1) */ SLEEP(1000); +-------------+ | SLEEP(1000) | +-------------+ | 1 | +-------------+ mysql>  SELECT /*+ MAX_EXECUTION_TIME(1000) */ 1 FROM t1 WHERE SLEEP(1000); ERROR 3024 (HY000): Query execution was interrupted, maximum statement execution time exceeded When  SLEEP()  is only part of a query that is interrupted, the query returns an error: mysql>  SELECT 1 FROM t1 WHERE SLEEP(1000); ERROR 1317 (70100): Query execution was interrupted This function is unsafe for statement-based replication. A warning is logged if you use this function when binlog_format  is set to  STATEMENT .