pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus Schaber <schabi@logix-tt.com>
To: Henry Ortega <juandelacruz@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Make Trigger run after completion of ENTIRE transaction
Date: Wed, 20 Sep 2006 11:24:14 +0200
Message-ID: <451108BE.5090905@logix-tt.com> (raw)
In-Reply-To: <2bffcc330609191200l5e84ec23x8db6b7beb89532e5@mail.gmail.com>
References: <2bffcc330609191200l5e84ec23x8db6b7beb89532e5@mail.gmail.com>

Hi, Henry,

Henry Ortega wrote:
> This maybe more of a theoretical question, can you actually make a
> Trigger run
> after completion of the entire transaction?
[...]
> ........... another 20-30 more inserts..........

Which frontend do yu use? Maybe COPY is better than insert.

> The trigger actually runs on each Insert and therefore slows down the
> Insert quite a bit.

This sounds like the trigger itsself could be optimized a bit, or does
some work that is not best suited to be in a trigger.

> My question is, can you tell the trigger to run after Commit?

I assume the trigger has to do some integrity checking work?

Could you reformulate it as foreign key or check constraints? (you may
even call a complex plpgsql function from the check constraint). Most
constraint checks can be deferred to the end of the transaction, see the
docs for more details.

HTH,
Markus

-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org



view thread (2+ messages)

Message-ID: <451108BE.5090905@logix-tt.com>
Permalink:  ../451108BE.5090905@logix-tt.com/
Also on:    postgresql.org/message-id/451108BE.5090905@logix-tt.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-sql@postgresql.org
  Cc: schabi@logix-tt.com, juandelacruz@gmail.com
  Subject: Re: Make Trigger run after completion of ENTIRE transaction
  In-Reply-To: <451108BE.5090905@logix-tt.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