Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 20AA86322C1 for ; Wed, 25 Aug 2010 11:30:43 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 63817-05 for ; Wed, 25 Aug 2010 14:30:34 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from web39702.mail.mud.yahoo.com (web39702.mail.mud.yahoo.com [209.191.106.48]) by mail.postgresql.org (Postfix) with SMTP id 90C33632B6C for ; Wed, 25 Aug 2010 11:30:34 -0300 (ADT) Received: (qmail 9244 invoked by uid 60001); 25 Aug 2010 14:30:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1282746632; bh=AX+GaVrmOOjGHQAYu1Z+h3WR9liPewixhU1LA0UU6kM=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=jp8NUj1oAHvbJT+mSbCOXuAqwqvhPWTExi1ugy+SewmufzKTHASz7qzMGkPek8/lb9jSnZwATxpsTp5/pxlsS7dhEDr6FO9klHBO/kNconKymF3rxVVuuQ88jIsI2MYUajFrasLmBhlIXREJ3MbuZlRUg0jiKAhfdFxtBG02as8= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=tFTMMU3yoA9YhpnoxxKUCmmWXmTHjPvXa+CmD5zI3YkNdWccURoJs0IN59nR8yloyrXOgL37Nq2knyPnEHPqtgcFfQoyAf/AdrWl4kfOp2h1AJoIpQd50Cvqw4KlsXeUvH+Ug2glGpReHa4o0LMaiybhnmvCg5vNEOzA2znkyzw=; Message-ID: <9650.2310.qm@web39702.mail.mud.yahoo.com> X-YMail-OSG: OUCpSaUVM1naV7a_CVBed9GSJKyUkIgKncu52dMGwkHA6.5 FUIzSKO_lofdv.oGylnIPyL3kAHTPIGWe3evy_Je.dsV4m42NGorZWN63wsc DK34Ze3YaM2pAzbQDqFKWvd1pZjpsnNIJ7Ox96ZTk7NphI8Ayhn9bgu7Uw6H Vfkw627msfm0gotuiA7Z9_DDh7yy0VJ.kZzBD5g8Ab6SbWeZI2lE.9FvMqz3 5sNtDeE06fbgV2sMYeylyl3Ekz01HJTiWkmN5H34QeS8SOrELuqlFPu9MIdO AO21CpxgqonfDhrSLZrxjIOIMTaGJUs_jHdVneKcvOztum5SLqKKjS49Zq4U 3kgpCwrBvV2LOrTSotQmhe4D5nqBdP8tA Received: from [64.126.29.122] by web39702.mail.mud.yahoo.com via HTTP; Wed, 25 Aug 2010 07:30:31 PDT X-Mailer: YahooMailClassic/11.3.2 YahooMailWebService/0.8.105.279950 Date: Wed, 25 Aug 2010 07:30:31 -0700 (PDT) From: Bob Lunney Subject: Re: Triggers or code? To: pgsql-performance@postgresql.org, DM In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-353847794-1282746631=:2310" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.909 tagged_above=-10 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201008/277 X-Sequence-Number: 40120 --0-353847794-1282746631=:2310 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable That depends on your application's requirements. =A0If a transaction on tab= le X fails, do you still want the history (noting the failure)? =A0If so, g= o with embedding the code in your script. =A0If you only want history for s= uccessful transactions, a trigger will take care of that for you automatica= lly. Bob Lunney=A0 --- On Mon, 8/23/10, DM wrote: From: DM Subject: [PERFORM] Triggers or code? To: pgsql-performance@postgresql.org Date: Monday, August 23, 2010, 2:42 PM Hello There, I have a table x and a history table x_hist, whats the best way to update t= he history table. should i need to use triggers or embed a code in my script to update the hi= story table? what is the performance impact of a trigger versus embedding the code in th= e script? =0A thanks for your time. - Deepak =0A=0A=0A=0A --0-353847794-1282746631=:2310 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
That depends on your application's requiremen= ts.  If a transaction on table X fails, do you still want the history = (noting the failure)?  If so, go with embedding the code in your scrip= t.  If you only want history for successful transactions, a trigger wi= ll take care of that for you automatically.

Bob Lunney&n= bsp;

--- On Mon, 8/23/10, DM <dm.aeqa@gmail.com>= wrote:

From: DM <dm.aeqa@gmail.com><= br>Subject: [PERFORM] Triggers or code?
To: pgsql-performance@postgresql= .org
Date: Monday, August 23, 2010, 2:42 PM

Hello There,

I have a table x and a history table x_hist, whats= the best way to update the history table.

should i need to use trig= gers or embed a code in my script to update the history table?

what is the = performance impact of a trigger versus embedding the code in the script?=0A
thanks for your time.

- Deepak
=0A

=0A=0A=0A=0A=0A=0A=0A=0A --0-353847794-1282746631=:2310--