Make Trigger run after completion of ENTIRE transaction

From: "Henry Ortega" <juandelacruz(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Make Trigger run after completion of ENTIRE transaction
Date: 2006-09-19 19:00:52
Message-ID: 2bffcc330609191200l5e84ec23x8db6b7beb89532e5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

This maybe more of a theoretical question, can you actually make a Trigger
run
after completion of the entire transaction?

Here's what I have:
LOG
user | startdate | enddate

enddate is getting updated by a trigger (on insert or update).

I have the following transaction:
BEGIN;
Insert into LOG(user,startdate) values('jdoe','2006-08-13');
Insert into LOG(user,startdate) values('jdoe','2006-08-14'); Insert into
LOG(user,startdate) values('jdoe','2006-08-15'); Insert into
LOG(user,startdate) values('jdoe','2006-08-16'); Insert into
LOG(user,startdate) values('jdoe','2006-08-17');
........... *another 20-30 more inserts..........*
COMMIT;

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

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2006-09-19 19:15:09 Re: Nested loops are killing throughput
Previous Message CG 2006-09-19 18:59:13 Re: Nested loops are killing throughput