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 993EED1E316 for ; Thu, 22 Jan 2004 16:44:07 +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 10670-05 for ; Thu, 22 Jan 2004 12:43:36 -0400 (AST) Received: from mail.unisoftbg.com (mail.unisoftbg.com [194.12.229.207]) by svr1.postgresql.org (Postfix) with ESMTP id 59F29D1D4AE for ; Thu, 22 Jan 2004 12:43:29 -0400 (AST) Received: (qmail 32428 invoked by uid 507); 22 Jan 2004 17:48:04 -0000 Received: from unknown (HELO t1.unisoftbg.com) (pginfo%t1.unisoftbg.com@194.12.229.193) by 0 with SMTP; 22 Jan 2004 17:48:03 -0000 Message-ID: <400FECD6.B835AF9C@t1.unisoftbg.com> Date: Thu, 22 Jan 2004 16:31:34 +0100 From: pginfo X-Mailer: Mozilla 4.03 [en] (Win95; I) MIME-Version: 1.0 To: Tom Lane Cc: "pgsql-performance@postgresql.org" Subject: Re: Trigger performance References: <400F9955.3C0FD784@t1.unisoftbg.com> <12241.1074785874@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/218 X-Sequence-Number: 5392 Hi, thanks for the answer. It is very interest, because I readet many times that if I write the trigger in "C" it will work faster. In wich case will this trigger work faster if write it in "C"? In all my triggres I have "select ...." or "insert into mytable select ..." or "update mytable set ...where...". I need this info because I have a table with ~1.5 M rows and if I start to update 300 K from this rows it takes ~ 2h. If I remove the trigger for this table all the time is ~ 1 min. regards, ivan. Tom Lane wrote: > 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 > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)