Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 9BD499FB412 for ; Tue, 20 Mar 2007 16:58:41 -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 26341-02 for ; Tue, 20 Mar 2007 16:58:24 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 6A66F9FB2F2 for ; Tue, 20 Mar 2007 16:58:26 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id l2KJwPaF016986; Tue, 20 Mar 2007 15:58:25 -0400 (EDT) To: Joseph S cc: pgsql-performance@postgresql.org Subject: Re: Horrible trigger performance after upgrade 8.0.12 -> 8.2.3 In-reply-to: References: Comments: In-reply-to Joseph S message dated "Tue, 20 Mar 2007 15:26:33 -0400" Date: Tue, 20 Mar 2007 15:58:25 -0400 Message-ID: <16985.1174420705@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/290 X-Sequence-Number: 23695 Joseph S writes: > 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. With no more details than that, I don't see how you expect any useful comments. Let's see the code. Also, what PG version are you comparing to? > BTW does make any sense to bother marking trigger functions as STABLE or > IMMUTABLE? No, the trigger mechanisms don't pay any attention to that. I can hardly conceive of a useful trigger that wouldn't be VOLATILE anyway, since side effects are more or less the point. regards, tom lane