sleep

Morning Furnace

Blog

It is a well-known, documented human physiological phenomenon that a person's body temperature will lower during sleep and rise before waking.

Pause a MySQL query with sleep

Snippet

For MySQL > 5.0.12, execution of a series of queries can be delayed / paused by using SELECT SLEEP(), which is useful when a previous query needs to be paused, say, when a slave is reconnecting to a master.

-- delay a query by one second
SELECT SLEEP(1);
 
-- delay a series of queries by a 30 seconds
SELECT SLEEP(30);
 
-- stop the slave, skip the error SQL, start the slave, pause a second, then check the slave status
STOP SLAVE; SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; START SLAVE; SELECT SLEEP(1); SHOW SLAVE STATUS;