Michal M Michal M - 6 months ago 14
SQL Question

How and when to use SLEEP() correctly in MySQL?

In relation to my other question today I am wondering how to use MySQL's

correctly.

From what I gathered reading MySQL Dev forums and very vague description in MySQL Docs I can't use it this way:

SELECT ...
SLEEP(1); /* wait for a second before another SELECT */
SELECT ...


So what is it good for then?

Answer
SELECT ...
SELECT SLEEP(5);
SELECT ...

But what are you using this for? Are you trying to circumvent/reinvent mutexes or transactions?

Comments