X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 96BE3D1EC41 for ; Tue, 23 Mar 2004 16:14:34 +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 37158-02 for ; Tue, 23 Mar 2004 12:14:32 -0400 (AST) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id EF4B6D1EC3E for ; Tue, 23 Mar 2004 12:14:31 -0400 (AST) Received: (qmail 23533 invoked by uid 500); 23 Mar 2004 16:17:31 -0000 Date: Tue, 23 Mar 2004 10:17:31 -0600 From: Bruno Wolff III To: Erik Thiele Cc: pgsql-sql@postgresql.org Subject: Re: fine grained trigger time specification... Message-ID: <20040323161731.GC22109@wolff.to> Mail-Followup-To: Erik Thiele , pgsql-sql@postgresql.org References: <20040323151913.13de3fa7.erik@thiele-hydraulik.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040323151913.13de3fa7.erik@thiele-hydraulik.de> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/236 X-Sequence-Number: 17335 On Tue, Mar 23, 2004 at 15:19:13 +0100, Erik Thiele wrote: > now sadly i am getting this kind of problem: > > > zeit=> insert into a select > nextval('delmeseq'),personalnumber,datum,datum from calendar where > type=10409; > INSERT 0 581 <-- see, 581 inserts which is pretty much :) > zeit=> commit; <-- now i have to wait for 581 calls of alwayscheck > > > since alwayscheck is not the fastest function on earth, i'd like to have > it called on commit time if at least one of table a or b was modified, > but always only once per commit. is there a way to formulate this: > > ARRANGE FOR CALL OF FUNCTION alwayscheck() ON COMMIT WHEN AT LEAST ONE > OF TABLE a OR TABLE b WAS MODIFIED BUT CALL THE FUNCTION AT MOST ONE > TIME; Wouldn't changing your triggers to be for each statement instead of for each row fix this?