postgres pg_sleep pg_sleep_for - ghdrako/doc_snipets GitHub Wiki
pg_sleep
db=# \timing
Timing is on.
db=# SELECT pg_sleep(3);
pg_sleep
──────────
(1 row)
Time: 3014.913 ms (00:03.015)
The function sleeps for the given number of seconds
pg_sleep_for
To make it more convenient to sleep for longer periods of time, PostgreSQL offers another function:
db=# SELECT pg_sleep_for('4 minutes 15 seconds');
Unlike its sibling pg_sleep, the function pg_sleep_for accepts an interval, which is much more natural to read and understand than the number of seconds.