Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 3B849633CF3 for ; Thu, 10 Dec 2009 11:48:39 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 40104-02-2 for ; Thu, 10 Dec 2009 15:48:19 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qy0-f189.google.com (mail-qy0-f189.google.com [209.85.221.189]) by mail.postgresql.org (Postfix) with ESMTP id 0014463331A for ; Thu, 10 Dec 2009 11:48:26 -0400 (AST) Received: by qyk27 with SMTP id 27so3583757qyk.20 for ; Thu, 10 Dec 2009 07:48:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=2WuJaUdSOpOkkocTc+4BYNvRC6RTbel+Mz5LMTnAp4U=; b=R8vamTrVf5/9IrDeJLxffJL558bRvjJLZAHWry7gXgsuVMPW66Q6lDK9RGF4X2pA2z zoIppH09+yKITffC7THPNeCEO9cCRs43Mfmyk/KgVBfY1uzocmw3Ku3FR9nScl1OQwFq WEajysq3pVvryXlyXs0QX2dzhKUJ/lV5AODWE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=VF0cChub3c0ET+5yMAl22hAMX8DEl+jErxDyQZFY0GV90wn6S97ul0SXqvl1na3dOX tg4KUGBEfLgWaCWiqZPEw6NqBR5OkuR1i5iArfI0Oe0qOSUwdFoeKVf2D5PfKpJ2u1IQ kAyFzCg29q7C3vuViMJunt11OSNT1ea26pcs8= MIME-Version: 1.0 Received: by 10.224.95.196 with SMTP id e4mr50616qan.180.1260460104852; Thu, 10 Dec 2009 07:48:24 -0800 (PST) In-Reply-To: <4B20F639.4070706@postnewspapers.com.au> References: <4B20F639.4070706@postnewspapers.com.au> Date: Thu, 10 Dec 2009 10:48:24 -0500 Message-ID: Subject: Re: Cheapest way to poll for notifications? From: Merlin Moncure To: Craig Ringer Cc: PG-General Mailing List Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.553 tagged_above=-10 required=5 tests=AWL=0.046, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200912/439 X-Sequence-Number: 156659 On Thu, Dec 10, 2009 at 8:23 AM, Craig Ringer wrote: > Hi > > As Pg doesn't presently support client push for notifications arising from > LISTEN/NOTIFY, I'm wondering if anybody here has done any research into the > cheapest statement to issue to check for such notifications. notifications are sent to the client as soon as they are generated and the socket is not otherwise being used. psql just prints the notifcation message following a query because that happens to be a convenient place to do it. The only polling that has to be done (if any) is 100% client side. There is an excellent example (in C) in the documentation showing a method of waiting on the connection socket for notification events when the connection is not in use by the client. merlin