Important
Helios features are now enabled during weekly update windows and are no longer directly tied to SingleStore engine releases. Refer to the release notes to view the latest features available in your Helios cluster.
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: