For a WAIT FOR test in MySQL, I use SLEEP with a bounded delay. A customer asked for the corresponding command.

-- MySQL alternatives, choose one for a controlled test:
SELECT SLEEP(5);
-- DO SLEEP(5);
-- SQL Server alternative, shown separately:
-- WAITFOR DELAY '00:00:05';SELECT SLEEP(5) returns zero after uninterrupted completion. DO SLEEP(5) evaluates without a result set. I prefer DO when no return value is needed.
Interruption, timeout and surrounding query context affect results or errors. Client elapsed time need not equal exactly five seconds. Keep MySQL and SQL Server syntax in their separate connections.
Use deliberate timing tests with bounded waits. A sleeping transaction can retain locks, and concurrent sleepers consume resources. Waiting does not cure a slow query or provide a complete retry strategy.
Reference: MySQL SLEEP behavior.
Related reading
A requested delay is not an exact client-duration guarantee, it is deliberate waiting whose context and interruption behavior matter.
Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.
Discover more from SQL Authority with Pinal Dave
Subscribe to get the latest posts sent to your email.




