Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 3BFB69FB409 for ; Tue, 20 Mar 2007 16:27:09 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 18875-03-7 for ; Tue, 20 Mar 2007 16:27:00 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 1DEDD9FB4D3 for ; Tue, 20 Mar 2007 16:27:02 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id F0FDA30909; Tue, 20 Mar 2007 20:27:00 +0100 (MET) From: Joseph S X-Newsgroups: pgsql.performance Subject: Horrible trigger performance after upgrade 8.0.12 -> 8.2.3 Date: Tue, 20 Mar 2007 15:26:33 -0400 Organization: Hub.Org Networking Services Lines: 9 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.0.10) Gecko/20070302 Fedora/1.5.0.10-1.fc6 pango-text Thunderbird/1.5.0.10 Mnenhy/0.7.4.0 To: pgsql-performance@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/289 X-Sequence-Number: 23694 After upgrading to 8.2.3 INSERTs and UPDATEs on one of my tables became incredibly slow. I traced the problem to one of my triggers that calls one of my defined functions (that is IMMUTABLE). If I inline the function instead of calling it the runtime for my test update drops from 10261.234 ms to 564.094 ms. The time running the trigger itself dropped from 9749.910 to 99.504. BTW does make any sense to bother marking trigger functions as STABLE or IMMUTABLE?