From: Csaba Nagy <nagy@ecircle-ag.com>
To: Michael Dengler <michael.dengler@gmail.com>
Cc: postgres performance list <pgsql-performance@postgresql.org>
Subject: Re: How to use a trigger to write rows to a remote server
Date: Wed, 18 Jul 2007 16:02:12 +0200
Message-ID: <1184767332.10897.6.camel@coppola.muc.ecircle.de> (raw)
In-Reply-To: <e8733d090707180636q45bb5d16vff3e79c2d60d2e83@mail.gmail.com>
References: <e8733d090707180636q45bb5d16vff3e79c2d60d2e83@mail.gmail.com>
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: nagy@ecircle-ag.com, michael.dengler@gmail.com
Subject: Re: How to use a trigger to write rows to a remote server
In-Reply-To: <1184767332.10897.6.camel@coppola.muc.ecircle.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox