Re: elegant and effective way for running jobs inside a database

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@commandprompt.com>
Cc: Merlin Moncure <mmoncure@gmail.com>, Dimitri Fontaine <dimitri@2ndquadrant.fr>, Josh Berkus <josh@agliodbs.com>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2012-03-06T22:53:00Z
Lists: pgsql-hackers
Alvaro Herrera <alvherre@commandprompt.com> writes:
> I was thinking that the connection would be kept open but no query would
> be running.  Does this preclude reception of notifies?  I mean, you
> don't sleep via "SELECT pg_sleep()" but rather a select/poll in the
> daemon.

No.  If you're not inside a transaction, notifies will be sent
immediately.  They'd be pretty useless if they didn't work that way ---
the whole point is for clients not to have to busy-wait.

			regards, tom lane