Re: Make Trigger run after completion of ENTIRE transaction

Поиск
Список
Период
Сортировка
От Markus Schaber
Тема Re: Make Trigger run after completion of ENTIRE transaction
Дата
Msg-id 451108BE.5090905@logix-tt.com
обсуждение исходный текст
Ответ на Make Trigger run after completion of ENTIRE transaction  ("Henry Ortega" <juandelacruz@gmail.com>)
Список pgsql-sql
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


В списке pgsql-sql по дате отправления:

Предыдущее
От: "CN"
Дата:
Сообщение: Need a SQL to create sets of hobbies
Следующее
От: Harald Fuchs
Дата:
Сообщение: Re: Need a SQL to create sets of hobbies