Re: Async triggers

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Async triggers
Дата
Msg-id 20070323175855.GC9623@svana.org
обсуждение исходный текст
Ответ на Async triggers  (Peter <peter@greatnowhere.com>)
Список pgsql-general
On Fri, Mar 23, 2007 at 07:30:17PM +0200, Peter wrote:
> Is this possible in PG somehow? Basically I need to call web service
> whenever new row is inserted in a table - the lookup takes time up to
> 10-15 seconds. Obviously I cant do this inside trigger proc as that
> would delay inserts a lot. I suppose I could do a cron job to do
> webservice lookups periodically, but that involves delay and added point
> of failure (if cron process stops working for whatever reason). Ideally
> async trigger proc would be the solution, but it seems I cant do
> asynchronous execution in PG.

Perhaps LISTEN/NOTIFY can do what you want. The problem with "async" is
that any query has to run on the context of some session. Which one?

Normally you have a queue table that queues work to be done, and
LISTEN/NOTIFY to wake up the daemon when there's something to do.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Вложения

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

Предыдущее
От: Peter
Дата:
Сообщение: Async triggers
Следующее
От: Mark
Дата:
Сообщение: Re: question: knopixx and postgresql on flash drive