X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1E0FED1D492 for ; Thu, 22 Jan 2004 15:38:26 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 93577-05 for ; Thu, 22 Jan 2004 11:37:58 -0400 (AST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 5C0EED1E919 for ; Thu, 22 Jan 2004 11:37:53 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id i0MFbtpH012242; Thu, 22 Jan 2004 10:37:56 -0500 (EST) To: pginfo Cc: "pgsql-performance@postgresql.org" Subject: Re: Trigger performance In-reply-to: <400F9955.3C0FD784@t1.unisoftbg.com> References: <400F9955.3C0FD784@t1.unisoftbg.com> Comments: In-reply-to pginfo message dated "Thu, 22 Jan 2004 10:35:17 +0100" Date: Thu, 22 Jan 2004 10:37:54 -0500 Message-ID: <12241.1074785874@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/217 X-Sequence-Number: 5391 pginfo writes: > I was supprised that the pgsql trigger take ~8 sec. to insert this rows > and the "C" trigger take ~ 17 sec. The reason is that plpgsql caches the plan for the invoked SELECT, whereas the way you coded the C function, it's re-planning that SELECT on every call. regards, tom lane