Received: from ngi.de (qmailr@[195.243.0.245]) by hub.org (8.10.1/8.10.1) with SMTP id e8M84Ds82650 for ; Fri, 22 Sep 2000 04:04:14 -0400 (EDT) Received: (qmail 13360 invoked from network); 22 Sep 2000 08:03:58 -0000 Received: from p3ee1e671.dip0.t-ipconnect.de (HELO mail.haneke.de) (62.225.230.113) by 195.243.0.245 with SMTP; 22 Sep 2000 08:03:58 -0000 Received: from Spooler by mail.haneke.de (Mercury/32 v3.01a) ID MO000358; 22 Sep 00 10:03:36 +0200 Received: from spooler by haneke.de (Mercury/32 v3.01a); 22 Sep 00 09:58:25 +0200 Received: from haneke.de (127.0.0.1) by Haneke Elektronik (Mercury/32 v3.01a) with ESMTP ID MG000357; 22 Sep 00 09:58:24 +0200 Message-ID: <39CB1120.DBEC91AB@haneke.de> Date: Fri, 22 Sep 2000 09:58:24 +0200 From: Elmar Haneke X-Mailer: Mozilla 4.75 [en] (WinNT; U) X-Accept-Language: de,en MIME-Version: 1.0 To: Adam Lang , PGSQL General Subject: Re: replication References: <001d01c023ca$e37d9cc0$330a0a0a@Adam> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200009/644 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