script_runtime

NAME

script_runtime(): return number of seconds elapsed since script execution began.

TYPE

Function

DESCRIPTION

This function returns the number of seconds elapsed since current QueryScript execution was launched.

It only makes sense to call this function from within a script (otherwise results are undefined).

script_runtime() returns a DOUBLE value, to support MySQL versions with subsecond resolution. Versions not supporting subsecond resolution (e.g. standard MySQL 5.1) will return with round values, which have an error margin of one second.

SYNOPSIS

script_runtime()
  RETURNS DOUBLE 

EXAMPLES

For 30 seconds, issue random queries against some table:

while (script_runtime() < 30)
{
  SELECT * FROM my_table WHERE id = RAND() * 100000;
}

ENVIRONMENT

MySQL 5.1 or newer

SEE ALSO

QueryScript

AUTHOR

Shlomi Noach
 
common_schema documentation