Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 7C5C7B5DBDA for ; Wed, 17 Aug 2011 04:05:40 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 38974-03 for ; Wed, 17 Aug 2011 07:05:33 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from softlayer.compulab.co.il (50.23.254.54-static.reverse.softlayer.com [50.23.254.54]) by mail.postgresql.org (Postfix) with ESMTP id 86B41B5D803 for ; Wed, 17 Aug 2011 04:05:33 -0300 (ADT) Received: from [62.90.235.247] (port=51302 helo=zimbra-mta.compulab.co.il) by softlayer.compulab.co.il with esmtp (Exim 4.69) (envelope-from ) id 1QtaBw-0004LV-PC for pgsql-general@postgresql.org; Wed, 17 Aug 2011 10:05:33 +0300 Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id BD6E87E94B2 for ; Wed, 17 Aug 2011 10:05:31 +0300 (IDT) X-Virus-Scanned: amavisd-new at compulab.co.il Received: from zimbra-mta.compulab.co.il ([127.0.0.1]) by localhost (zimbra-mta.compulab.co.il [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wEkEMcJUuZZR for ; Wed, 17 Aug 2011 10:05:31 +0300 (IDT) Received: from [10.1.1.27] (sim-pc.compulab.local [10.1.1.27]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id 34D4D7E94B1 for ; Wed, 17 Aug 2011 10:05:31 +0300 (IDT) Message-ID: <4E4B6828.1050506@compulab.co.il> Date: Wed, 17 Aug 2011 10:05:12 +0300 From: Sim Zacks User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.18) Gecko/20110617 Lightning/1.0b2 Thunderbird/3.1.11 MIME-Version: 1.0 To: pgsql-general@postgresql.org Subject: Re: Using Postgresql as application server References: <4E498536.9080109@darrenduncan.net> <008301cc5b95$e287b120$a7971360$@yahoo.com> <4E49A208.5070604@darrenduncan.net> <4E49EC4D.1090707@darrenduncan.net> In-Reply-To: <4E49EC4D.1090707@darrenduncan.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - softlayer.compulab.co.il X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - compulab.co.il X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.132 tagged_above=-5 required=5 tests=BAYES_00=-1.9, KHOP_DYNAMIC=0.768 X-Spam-Level: X-Archive-Number: 201108/540 X-Sequence-Number: 178822 On 08/16/2011 07:04 AM, Darren Duncan wrote: > Chris Travers wrote: >> On Mon, Aug 15, 2011 at 3:47 PM, Darren Duncan >> wrote: >>> I believe we basically have all the foundation already, with maybe >>> procedures executable outside transactions being the last major part. >>> >> Why is this desirable? Why is it more desirable than actually using >> the listen/notify infrastructure that exists already? > > Maybe listen/notify is sufficient by itself. I withdraw my "procedures > executable outside transactions" comment for now, and just bring it up > later if I can think of a specific use case that other mechanisms don't > satisfy. -- Darren Duncan > LISTEN/NOTIFY is good if you want to call an outside application, however, if you want to call another database function, then it is just plain wrong. I need a daemon that will listen to for notify calls so that it can open a new database session and call the function. With an asynchronous function, my function would be able to spawn a new session and run in its own transaction while the calling function would be able to complete and go away. See http://archives.postgresql.org/pgsql-hackers/2011-04/msg01503.php for my proposal on this issue. One problem we have with LISTEN/NOTIFY (and I haven't found the cause for this yet) is every once in a while my daemon stops listening. It may be after a month of use or longer, and may be caused by the database being restarted or something similar. When the daemon stops listening, it doesn't give any errors or indication that it isn't working anymore. It is only after a user complains that something hasn't been updated in a day or so that we manually restart it. It doesn't happen very often, but it does happen on occasion.