X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7141111F61C0 for ; Fri, 14 Apr 2006 15:01:30 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 required=5 tests=[none] Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id ph59A0RSFEFI for ; Fri, 14 Apr 2006 15:01:20 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from pproxy.gmail.com (pproxy.gmail.com [64.233.166.176]) by postgresql.org (Postfix) with ESMTP id 7ADDC11F6CC6 for ; Fri, 14 Apr 2006 15:01:08 -0300 (ADT) Received: by pproxy.gmail.com with SMTP id x66so120090pye for ; Fri, 14 Apr 2006 11:01:08 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; b=PDCtbXhUgRD/meeJ7kjBxWffchlwnuXI5vH28vbaWaz4I5KmRF6IPlhZM6usuorNxbEPPETJkRt9rAIGJu41vUZb9+ydyCs5dw044TEB2NrE3Q1JnK+nUMKeJAhuorllzisZM/yQweeQP8IEdzB60EiufG+xNtZ2jezoJKwsLIM= Received: by 10.35.34.20 with SMTP id m20mr620246pyj; Fri, 14 Apr 2006 11:01:08 -0700 (PDT) Received: from ?192.168.51.41? ( [209.209.36.196]) by mx.gmail.com with ESMTP id f20sm273989pyf.2006.04.14.11.01.07; Fri, 14 Apr 2006 11:01:08 -0700 (PDT) In-Reply-To: <2847.1144975434@sss.pgh.pa.us> References: <1144135482.063425.33380@z34g2000cwc.googlegroups.com> <20060411225515.GZ49405@pervasive.com> <200604121603.43986.josh@agliodbs.com> <20060413001024.GP49405@pervasive.com> <6236.1144888514@sss.pgh.pa.us> <4D23826E-7325-4946-B79A-80E321E0E497@gmail.com> <26792.1144949880@sss.pgh.pa.us> <2847.1144975434@sss.pgh.pa.us> Mime-Version: 1.0 (Apple Message framework v749.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <79637789-3BD1-4450-BD72-C0025225E900@gmail.com> Cc: PFC , "Jim C. Nasby" , "Josh Berkus" , pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Christian Storm Subject: Re: pgmemcache Date: Fri, 14 Apr 2006 11:01:10 -0700 To: Tom Lane X-Mailer: Apple Mail (2.749.3) X-Archive-Number: 200604/356 X-Sequence-Number: 18440 > I'll let you in on a secret: NOTIFY is actually a before-commit > operation. This is good enough because it never, or hardly ever, > fails. I would argue that anything you want to do in an AFTER COMMIT > trigger could just as well be done in a BEFORE COMMIT trigger; if > that's > not reliable enough then you need to fix your trigger. So, looping back to pgmemcache. It doesn't seem like it's about the trigger failing; it's about the transaction failing. How could I 'fix my trigger' so that if the transaction fails the cache wouldn't be updated? > An AFTER COMMIT trigger would have to be in a separate transaction. Agreed. Each trigger being in its own transaction. > What happens if there's more than one, and one of them fails? Each AFTER COMMIT trigger would be in its own transaction. So if it fails, let it fail. It isn't the original transactions fault. If you want it to bundled with the original transaction then do a BEFORE COMMIT. If there is more than one, so be it. One may fail, another may not. If that is not okay or the intended behavior, then create a new trigger than combines them into one transaction so that they are coupled. > Even > more to the point, if it's a separate transaction, don't you have > to fire all these triggers again when you commit that transaction? > The idea seems circular. Why would it have to do this? Not sure if I follow. In my mind, the only way this would happen is if the AFTER COMMIT trigger acted upon the very same table it is triggered off of. Then you could have a circular reference. However, this is true for the BEFORE COMMIT situation too. I don't see the difference. What am I missing? Cheers, Christian