Re: How to use a trigger to write rows to a remote server - Mailing list pgsql-performance

From Csaba Nagy
Subject Re: How to use a trigger to write rows to a remote server
Date
Msg-id 1184767332.10897.6.camel@coppola.muc.ecircle.de
Whole thread Raw
In response to How to use a trigger to write rows to a remote server  ("Michael Dengler" <michael.dengler@gmail.com>)
Responses Re: How to use a trigger to write rows to a remote server
List 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 by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: How to use a trigger to write rows to a remote server
Next
From: Tom Lane
Date:
Subject: Re: How to use a trigger to write rows to a remote server