Received: from smtp016.mail.yahoo.com (smtp016.mail.yahoo.com [216.136.174.113]) by postgresql.org (Postfix) with SMTP id 797F5475DFE for ; Wed, 3 Apr 2002 11:47:37 -0500 (EST) Received: from psc.progress.com (HELO saturn.janwieck.net) (janwieck@192.233.92.200 with login) by smtp.mail.vip.sc5.yahoo.com with SMTP; 3 Apr 2002 16:47:41 -0000 Received: (from wieck@localhost) by saturn.janwieck.net (8.11.2/8.11.2) id g33Gixc32234; Wed, 3 Apr 2002 11:44:59 -0500 From: Jan Wieck Message-Id: <200204031644.g33Gixc32234@saturn.janwieck.net> Subject: Re: Update in trigger In-Reply-To: <3CAA7942.592D079B@mithrandir.hu> from "[Ikl_di] Lajos" at "Apr 3, 2002 05:38:42 am" To: "[Ikl_di] Lajos" Date: Wed, 3 Apr 2002 11:44:59 -0500 (EST) Cc: "pgsql-sql@postgresql.org" X-Mailer: ELM [version 2.4ME+ PL68 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archive-Number: 200204/33 X-Sequence-Number: 7298 [Ikl_di] Lajos wrote: [Charset iso-8859-2 unsupported, filtering to ASCII...] > Hi, > I have a problem with trigger in 7.1.3. > I have a table with after insert trigger, which is making updates in > another table. > I recognized that the more records I have in first table the slower is > my insert. > If my trigger is doing something else, for example inserts in another > table, it becomes * 20 times * quicker, and the speed of my insert > doesn't depend on tablesize. > Don't I have to make updates in trigger? Are there appropriate indexes on the table updated in the trigger and is the database "VACUUM ANALYZE"ed so the indexes get used? Even if it is an AFTER INSERT trigger, your INSERT has to wait until the trigger finishes, because it still has a right to abort the transaction. Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com #