Declaration
SLEEP(duration)
Description
The SLEEP function pauses for the duration specified by duration seconds and returns 0 after the pause ends.
If
SLEEPis executed alone and not interrupted, the return result is0.If the
SLEEPstatement is interrupted while it is being executed alone, the result code1is returned, but no error code is returned.If
SLEEPis part of a query and the query is interrupted during the pause, error codeERROR 1317is returned.
Examples
obclient> SELECT SLEEP(1000);
+------------------+
| SLEEP(1000) |
+------------------+
| 0 |
+------------------+
obclient> SELECT SLEEP(1000);
+------------------+
| SLEEP(1000) |
+------------------+
| 1 |
+------------------+
obclient> SELECT 1 FROM t1 WHERE SLEEP(1000);
ERROR 1317 (70100): Query execution was interrupted