1

I don't know how to use SELECT SLEEP(). It looks like a dirty hack.

I found an interesting question How and when to use SLEEP() correctly in MySQL?. The answer is developer oriented:

If you don't want to SELECT SLEEP(1);, you can also DO SLEEP(1); It's useful for those situations in procedures where you don't want to see output.

what are examples for DBA?

| improve this question | | | | |
  • 1
    Sounds a bit like a "go slower" button to me. – Max Vernon Jun 9 '16 at 16:20
3

I have used it to create backups where I sleep until I can get a process ID from the processlist that is holding a database lock. I mentioned this idea back on Apr 17, 2011 in my answer to the post How can I optimize a mysqldump of a large database?

I wrote the answer to another post Jun 20, 2012 that has the actual code where I demonstrated the use of SELECT SLEEP (Safest way to perform mysqldump on a live system with active reads and writes?)

I have done things like this in the OS making physical backups using bash. I simply did the same in MySQL itself.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.