In today’s article, we will learn how to use the pg_sleep() function to delay execution for a given number of seconds in PostgreSQL.
For example, you need to run a process after half an hour.
You can use the pg_sleep() function for this.
We need to give the pg_sleep() function a value in seconds.
The syntax is quite simple:
1 | pg_sleep(seconds) |
Example usage is as follows.
1 | select pg_sleep(5),localtime |