pg_sleep() is a system function for causing the connected backend to sleep for the specified number of seconds.
pg_sleep() was added in PostgreSQL 8.2.
pg_sleep ( double precision ) → returns NULL
The documentation notes the following caveats:
- the minimum sleep interval is platform-dependent and is typically
- the sleep delay will always be at least the value specified, but may be longer under some circumstances
Basic execution of
postgres=# SELECT pg_sleep(1); pg_sleep ---------- (1 row) Time: 1001.172 ms (00:01.001)
The sleep duration can be specified as fractions of a second, e.g.:
postgres=# SELECT pg_sleep(0.5); pg_sleep ---------- (1 row) Time: 500.770 ms