Re: replication - Mailing list pgsql-general

From Elmar Haneke
Subject Re: replication
Date
Msg-id 39CB1120.DBEC91AB@haneke.de
Whole thread Raw
In response to replication  ("Adam Lang" <aalang@rutgersinsurance.com>)
Responses Re: replication
List pgsql-general

Adam Lang wrote:
>
> Are there any type of replication features in postgresql 7.0?
>
> I would like it where two databases have the same structure, but say at
> midnight every night Database 1 synchs up database 2.
>
> Granted, I could always write code to do that, but it wouldn't be very
> sophisticated.  (If I coded it,  would do something like find rows in table
> 1 which aren't in the second database, append them database two, same with
> the second table, etc.)

I would suggest to consider the xmin values stored with each row in
database. This number does contain the transaction-number of the
last change to this tuple.

An replication should copy all tuples having larger xmin than
copied by the last replication. If each table has an primary key,
replication can decide wether the tuple is updated or inserted.

For deletes you should consider to use triggers copying the keys
of deleted tuples to an "delete-log-table". If an delete-transaction
is aborted, the entries to this table should be cancelled
automatically by the transaction control.

I'm not sure wether you can use the oid as an key for this purpose.
Is oid updatable to keep it in sync on both databases?

Elmar

pgsql-general by date:

Previous
From: Vadim Govorov
Date:
Subject: Trouble with WIN charset
Next
From: Mathieu Arnold
Date:
Subject: data replication