Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 1EAD4B5DBD9 for ; Thu, 18 Aug 2011 08:33:12 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 07907-04 for ; Thu, 18 Aug 2011 11:33:05 +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 105E0B5DBC4 for ; Thu, 18 Aug 2011 08:33:04 -0300 (ADT) Received: from [62.90.235.247] (port=34028 helo=zimbra-mta.compulab.co.il) by softlayer.compulab.co.il with esmtp (Exim 4.69) (envelope-from ) id 1Qu0qN-0000K5-D9 for pgsql-general@postgresql.org; Thu, 18 Aug 2011 14:33:04 +0300 Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id B7EAF7E954C for ; Thu, 18 Aug 2011 14:33:01 +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 Ta46NvNFUL+p for ; Thu, 18 Aug 2011 14:33:01 +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 29C5A7E952B for ; Thu, 18 Aug 2011 14:33:01 +0300 (IDT) Message-ID: <4E4CF84E.1030707@compulab.co.il> Date: Thu, 18 Aug 2011 14:32:30 +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: PostgreSQL general 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> <4E4B6828.1050506@compulab.co.il> <46EC79AF-3685-484E-AABE-E25969C23D56@elevated-dev.com> <4E4C9744.4060407@compulab.co.il> In-Reply-To: Content-Type: text/html; charset=ISO-8859-1 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=-0.379 tagged_above=-5 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001, KHOP_DYNAMIC=0.797, MIME_HTML_ONLY=0.723 X-Spam-Level: X-Archive-Number: 201108/593 X-Sequence-Number: 178875 On 08/18/2011 07:57 AM, Chris Travers wrote:
On Wed, Aug 17, 2011 at 9:38 PM, Sim Zacks <sim@compulab.co.il> wrote:

The point was not whether I have a bug in an external application, the point
is that I need an external application which creates more overhead and
another point of failure in the application stack.

1)  Not sure how an external python script is different from a
PL/Python sproc except that the former exists external to transaction
control.
There are many differences.
1) If I have a database function and I copy my database to another server, the function still works.
If I have an external daemon application, I not only have to copy my database, I also have to copy the daemon application. Then I have to build an init script and make sure it runs at startup. My LISTEN/NOTIFY daemon is a c application, so when I move my database to a server on a different platform, I have to recompile it. 
2) there is absolutely no reason you can't build redundancy into this system.
Its not a question of whether I can or cannot build redundancy, it is a question of whether I have to build an entire system in order to call a database function from another database function. The only reason this is complicated is because it needs to be in its own session. That simple issue shouldn't force me to build: a) a daemon application, b) include redundancy to ensure that it is running, c) not be included in my database backup/restore.
Remember, I don't want to build a _system_, I basically want an asynchronous trigger. On specific event call a database function in its own transaction space and allow the existing transaction to end.
3)  The overhead really shouldn't be bad, and if your parts are
well-modularized, and carefully designed overhead really should be
minimal.
Any overhead that is not necessary should not be added in. It is the minor level of frustration that something didn't work when I migrated servers until the "Oh Yeah" kicked in. Then looking through all my notes to find the compilation instructions for my daemon because we moved from a 32 bit server to a 64 bit. Then trying to figure out the syntax for the init script, because we moved from Gentoo to Debian and it is slightly different. It isn't a lot of overhead but it is completely unneccessary in our situation.
I will agree that this is entirely necessary if your application actually uses an external system and the database communicates through Listen/Notify. You have 2 systems to deal with in any case, but for me the only external component is having the daemon listen so it can call another function in the database. IOW, I don't generally deal with anything else on the server.

Best Wishes,
Chris Travers

Sim