SLEEP
Syntax
SLEEP(duration)
Description
The SLEEP function pauses for the specified number of seconds (duration) and returns 0 after the pause.
-
If
SLEEPis executed alone and not interrupted, it returns0. -
If
SLEEPis executed alone and interrupted, it returns1without any error code. -
If
SLEEPis part of a query and interrupted during the pause, it returns the error codeERROR 1317.
Examples
SELECT SLEEP(1000);
+------------------+
| SLEEP(1000) |
+------------------+
| 0 |
+------------------+
SELECT SLEEP(1000);
+------------------+
| SLEEP(1000) |
+------------------+
| 1 |
+------------------+
SELECT 1 FROM t1 WHERE SLEEP(1000);
ERROR 1317 (70100): Query execution was interrupted