Important
The SingleStore 9.1 release candidate (RC) is available now. It will be promoted to general availability (GA) soon and at that time it will be renamed to SingleStore 10.
In the interim, SingleStore 9.1 RC can be used to preview, evaluate, and provide feedback on the new and upcoming features in SingleStore 10, while SingleStore 9.0 is recommended for production workloads.
SLEEP
On this page
The SLEEP() function halts execution of the thread for the given number of seconds.
Syntax
SLEEP ( seconds )Arguments
-
seconds: the number of seconds (or fraction) to sleep the thread.
Return type
Returns an integer.SLEEP() returns the number 0 if it returns normally without interruption.SLEEP() returns the number 1.
Examples
This function is useful mainly for debugging and measurement purposes, e.
SELECT NOW(); SELECT SLEEP(10); SELECT NOW();***+---------------------+| NOW() |+---------------------+| 2015-03-02 23:22:25 |+---------------------++-----------+| SLEEP(10) |+-----------+| 0 |+-----------++---------------------+| NOW() |+---------------------+| 2015-03-02 23:22:35 |+---------------------+
You can also specify fractions of a second:
SELECT NOW(6); SELECT SLEEP(0.25); SELECT NOW(6);
+----------------------------+
| NOW(6) |
+----------------------------+
| 2021-07-28 18:09:08.596529 |
+----------------------------+
1 row in set (0.01 sec)
+-------------+
| SLEEP(0.25) |
+-------------+
| 0 |
+-------------+
1 row in set (0.26 sec)
+----------------------------+
| NOW(6) |
+----------------------------+
| 2021-07-28 18:09:08.850666 |
+----------------------------+
1 row in set (0.00 sec)Last modified: