Re: Triggers or code?

From: Bob Lunney <bob_lunney(at)yahoo(dot)com>
To: pgsql-performance(at)postgresql(dot)org, DM <dm(dot)aeqa(at)gmail(dot)com>
Subject: Re: Triggers or code?
Date: 2010-08-25 14:30:31
Message-ID: 9650.2310.qm@web39702.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

That depends on your application's requirements.  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 script.  If you only want history for successful transactions, a trigger will take care of that for you automatically.
Bob Lunney 

--- On Mon, 8/23/10, DM <dm(dot)aeqa(at)gmail(dot)com> wrote:

From: DM <dm(dot)aeqa(at)gmail(dot)com>
Subject: [PERFORM] Triggers or code?
To: pgsql-performance(at)postgresql(dot)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 triggers 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?

thanks for your time.

- Deepak

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Bob Branch 2010-08-25 15:58:16 New servers, need suggestions for sensible tuning settings
Previous Message Guillaume Lelarge 2010-08-25 06:58:59 Re: Are Indices automatically generated for primary keys?