Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 0AECB9F9F8F for ; Wed, 3 Jan 2007 10:23:10 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 26581-10 for ; Wed, 3 Jan 2007 10:23:04 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by postgresql.org (Postfix) with ESMTP id 493449F95E3 for ; Wed, 3 Jan 2007 10:23:04 -0400 (AST) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 84E7774A3F; Wed, 3 Jan 2007 14:22:58 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 42317FF04; Wed, 3 Jan 2007 14:22:58 +0000 (GMT) Message-ID: <459BBC41.1070804@archonet.com> Date: Wed, 03 Jan 2007 14:22:57 +0000 From: Richard Huxton User-Agent: Thunderbird 1.5.0.8 (X11/20061115) MIME-Version: 1.0 To: ramachandra.bhaskaram@wipro.com Cc: pgsql-sql@postgresql.org Subject: Re: [SQL NOTIFY Help] sending NOTIFY to the external program References: <47230CE166B64744B0120173E4C2161E0103E6A1@BLR-EC-MBX01.wipro.com> In-Reply-To: <47230CE166B64744B0120173E4C2161E0103E6A1@BLR-EC-MBX01.wipro.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/6 X-Sequence-Number: 27158 ramachandra.bhaskaram@wipro.com wrote: > Yes, our application is supposed to know *immediately* that a change in > the database has occurred since, based on this modified data it is doing > lot of other operations and also, the db transactions are heavy(expected > to be arround 300 tps(transactions per sec)). > > I agree that this can be done using some untrusted languages, written to > a file and then the application can look into the file for the modified > date. But, as far as performance is concerned it will take time for the > application to get the response. The user on the application side might > not be kept in waiting state until this transaction happens. Needn't take time, if the O.S. you're on can notify you of file writes, but in any case I'd look at communicating over a socket (unix or tcp/ip) if you want immediate notification. It's simple enough in perl or python (or ruby, or any of those). Oh, and you'll need to cope with the case: 1. Transaction containing the update is rolled back 2. Notification has already left the database -- Richard Huxton Archonet Ltd