Re: How to use a trigger to write rows to a remote server

Поиск
Список
Период
Сортировка
От Csaba Nagy
Тема Re: How to use a trigger to write rows to a remote server
Дата
Msg-id 1184767332.10897.6.camel@coppola.muc.ecircle.de
обсуждение исходный текст
Ответ на How to use a trigger to write rows to a remote server  ("Michael Dengler" <michael.dengler@gmail.com>)
Ответы Re: How to use a trigger to write rows to a remote server
Список pgsql-performance
On Wed, 2007-07-18 at 15:36, Michael Dengler wrote:
> Row X is inserted into TableX in DB1 on server1....TableX trigger
> function fires and contacts DB2 on server2 and inserts the row into
> TableY on server2.

This kind of problem is usually solved more robustly by inserting the
"change" into a local table and let the remote server (or some external
program) poll that periodically, and make the necessary changes to the
remote server. This method does not have the problems Heikki mentions in
his reply with disconnections and transaction rollbacks, as the external
program/remote server will only see committed transactions and it can
apply the accumulated changes after connection is recovered in case of
failure, without blocking the activity on the "master".

This is also covered in a few past posts on the postgres lists (I guess
you should look in the "general" list for that), in particular you could
be interested in the possibility of notifications if you want your
poller to be notified immediately when a change occurs.

Cheers,
Csaba.



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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: How to use a trigger to write rows to a remote server
Следующее
От: Tom Lane
Дата:
Сообщение: Re: How to use a trigger to write rows to a remote server