query_script_sleep

sleep: suspend execution for a given number of seconds

SYNOPSIS

sleep <number>;
sleep $seconds;
sleep @seconds;

DESCRIPTION

sleep is a QueryScript statement which, when invoked, makes for a non-busy wait for a given period of time. Essentially, it is a convenience statement making for a shortcut to a "DO SLEEP()" execution.

sleep takes a number as a parameter, which is the time, in seconds, for which the script is to sleep. The number can be an integer or a floating point, and it is interpreted as follows:

  • 0 or less: no sleep is done. It makes no sense to provide such values
  • x, a positive number: sleep for given number of seconds.

sleep also accepts a local variable or a MySQL user defined variable as argument. Such argument is cast to a number and handled as specified above.

EXAMPLES

Purge rows from table, sleep for 2 seconds in between operations:

while (delete from world.City limit 10)
{
  sleep 2.0;
}

SEE ALSO

script_runtime(), Statements, throttle

AUTHOR

Shlomi Noach
 
common_schema documentation