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?

Sybil
  • 2,578
  • 6
  • 34
  • 61

1 Answers1

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.

RolandoMySQLDBA
  • 185,223
  • 33
  • 326
  • 536