"John D. Burger" <john@xxxxxxxxx> writes: > Does anyone have any suggestions for how to write client python code > that uses LISTEN? The only thing I can find is the older PyGreSQL > module (import pg), which has getnotify(), but this seems to require > busy-waiting. Is there any way to do this that will use select() or > something under the covers, so my client doesn't spin up the cpu? > (Yes, I know I could poll-sleep-poll-sleep - that's what I'll do if > there's nothing cleaner.) The standard approach when using libpq directly is to get the file descriptor number of the backend connection with PQsocket(), then include that in the set of FDs that the client app's idle loop select()s or poll()s on. Read-ready on the socket doesn't necessarily mean that a NOTIFY has arrived, but it's at least sufficient info to justify waking up and checking libpq's status. Dunno if you can translate that into python readily ... regards, tom lane