I have a set of queries in my queries.sql file which I am feeding to psql for execution. But I don't want them to run instantly one after the other: I would like to set some sort of delay - I was looking at \watch and query buffer but I am not so sure how to proceed. I would prefer not to write PG_SLEEP after each of my queries.
\watch executes the query buffer (one statement). It doesn't loop through different statements.
\set title "EVAN SAYS HAI" SELECT 'HELLO WORLD' AS "Evan Greets the Plebs"; \watch
Now move that window over to your fifth monitor and when the boss comes by pretend like you're waiting for it to change.
If you want to put a delay in between query executions, make a spool as @Craig Ringer said in the comments
Write a Python or Perl script with your list of queries and have it loop over them, sleeping after each execution. – Craig Ringer Mar 5 at 11:18
You can do it one line or whatever too..
echo -e "SELECT 1;\nSELECT 2;\nSELECT 3;" | perl -pe'$|=1; sleep 1;' | psql -d foo;