pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bob Lunney <bob_lunney@yahoo.com>
To: pgsql-performance@postgresql.org, DM <dm.aeqa@gmail.com>
Subject: Re: Triggers or code?
Date: Wed, 25 Aug 2010 07:30:31 -0700 (PDT)
Message-ID: <9650.2310.qm@web39702.mail.mud.yahoo.com> (raw)
In-Reply-To: <AANLkTingyH4s9ZUa9in0rtFsCOGXhu+dc++kmYt5yNaa@mail.gmail.com>

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.aeqa@gmail.com> wrote:

From: DM <dm.aeqa@gmail.com>
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 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




      

view thread (3+ messages)

Message-ID: <9650.2310.qm@web39702.mail.mud.yahoo.com>
Permalink:  ../9650.2310.qm@web39702.mail.mud.yahoo.com/
Also on:    postgresql.org/message-id/9650.2310.qm@web39702.mail.mud.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: bob_lunney@yahoo.com, dm.aeqa@gmail.com
  Subject: Re: Triggers or code?
  In-Reply-To: <9650.2310.qm@web39702.mail.mud.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox