Re: replication

From: Elmar Haneke <elmar(at)haneke(dot)de>
To: Adam Lang <aalang(at)rutgersinsurance(dot)com>, PGSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: replication
Date: 2000-09-22 07:58:24
Message-ID: 39CB1120.DBEC91AB@haneke.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vadim Govorov 2000-09-22 07:59:42 Trouble with WIN charset
Previous Message James Cribb 2000-09-22 06:04:15 How to get PGconn inside a user-defined C function?