Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 480689FB22C for ; Thu, 2 Nov 2006 08:46:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 49103-01 for ; Thu, 2 Nov 2006 08:45:55 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.169]) by postgresql.org (Postfix) with ESMTP id 017A29FB1CB for ; Thu, 2 Nov 2006 08:45:54 -0400 (AST) Received: by ug-out-1314.google.com with SMTP id k3so93699ugf for ; Thu, 02 Nov 2006 04:45:53 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type; b=bVwXLud2XTpy42AWnvWJFpRG6NpyiIU2AvOaG4byi0Wnl5JraM4UA+UFz7Z3A5NoK3r54enOieXg+vxmSwU5YSzw+mJjrD5ZLtBqDIG8krV8te8AvU9zHPhRJaU80D2T73oMsYdaGiSsfilYUMBWcqF9Md7r7EhI2Nz/m67nL9M= Received: by 10.78.97.7 with SMTP id u7mr538723hub.1162471553141; Thu, 02 Nov 2006 04:45:53 -0800 (PST) Received: by 10.78.130.6 with HTTP; Thu, 2 Nov 2006 04:45:53 -0800 (PST) Message-ID: <36af4bed0611020445s445e3fe8o344f529190a8dfea@mail.gmail.com> Date: Thu, 2 Nov 2006 18:15:53 +0530 From: Robins Reply-To: robins@pobox.com To: pgsql-performance@postgresql.org Subject: Locking vs. Exceptions MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_3188_11638761.1162471553072" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.552 tagged_above=0 required=5 tests=BAYES_50, DNS_FROM_RFC_ABUSE, HTML_10_20, HTML_MESSAGE, SPF_PASS X-Spam-Level: * X-Archive-Number: 200611/22 X-Sequence-Number: 21792 ------=_Part_3188_11638761.1162471553072 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, The documentation says that function blocks with exceptions are far costlier than without one. So if I need to implement an INSTEAD OF trigger (after checking for unique constraint violations) which way should I go ? 1. Get a table lock 2. Use 'Select ... For Update' (which could be used to lock only the desired recordsets) 3. Use Exceptions Any advice / experiences or even pointers would be helpful. Thanks Robins Tharakan ------=_Part_3188_11638761.1162471553072 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi,

The documentation says that function blocks with exceptions are far costlier than without one.

So if I need to implement an INSTEAD OF trigger (after checking for unique constraint violations) which way should I go ?

1. Get a table lock
2. Use 'Select ... For Update' (which could be used to lock only the desired recordsets)
3. Use Exceptions

Any advice / experiences or even pointers would be helpful.

Thanks
Robins Tharakan
------=_Part_3188_11638761.1162471553072--