Trigger concurrent execution

Поиск
Список
Период
Сортировка
От Blagoj Petrushev
Тема Trigger concurrent execution
Дата
Msg-id CAKe+-76yWqD=Wv9ifvPEp59r7=KZUJqG7zvO7zmc3PS==VF2+Q@mail.gmail.com
обсуждение исходный текст
Ответы Re: Trigger concurrent execution
Re: Trigger concurrent execution
Список pgsql-hackers
Hi,

I'm thinking of an extension to trigger functionality like this:

CREATE TRIGGER trigger_name   AFTER event   ON table   CONCURRENTLY EXECUTE PROCEDURE trigger_fc

This would call the trigger after the end of the transaction.

The following is a use-case, please tell me if I'm doing it wrong.

I have a big table with big text column article and a nullable
tsvector column fts_article. On each insert or update that changes the
article, I trigger-issue 'NOTIFY article_changed row_id', then, with a
daemon listener, I catch the notification and update fts_article
accordingly with my_fts_fc(article). The reason I don't do this
directly in my trigger is because my_fts_fc is slow for big articles,
fts_article has a gin index, and also, on heavy load, my listener can
do these updates concurrently. Now, with a concurrent execution of
triggers, I can just call my_fts_fc inside the trigger instead of the
notify roundtrip.

Kind regards,
Blagoj Petrushev



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

Предыдущее
От: Tomas Vondra
Дата:
Сообщение: Re: buildfarm animals and 'snapshot too old'
Следующее
От: Andres Freund
Дата:
Сообщение: Re: 9.4 release notes