Re: Copying only incremental records to another DB..

From: Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>
To: Phoenix Kiula <phoenix(dot)kiula(at)gmail(dot)com>
Cc: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Copying only incremental records to another DB..
Date: 2009-07-24 11:07:02
Message-ID: A0AEB27E-AD7B-4BB3-9E69-0411ABAF2F45@solfertje.student.utwente.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 29 Jun 2009, at 6:10, Phoenix Kiula wrote:

> Hi
>
> We're trying PG on a new machine, so we copied our current (live)
> database to that server. Tested the code and it's all working. Now, to
> make that second server the main live server, we will need to copy the
> db again including the new records since we copied for testing. Is
> there any way to copy only the incremental records in all the tables?

It would be nice if there were a tool that could do a diff between two
dumps resulting in a new dump with just the statements necessary to
apply the differences. I don't think there is such a tool yet though
(some light Googling does bring up such a tool for sqllite).
Implementing it does have a few challenges, changes to records with
foreign keys for example.

Barring the availability of such a tool, there are some tools out
there that can 'diff' two XML files and, seeing that the xml module
can export tables to a pre-defined XML format, you may be able to do
something using that. What to do with the resulting XML file is
another story, some XSLT could probably turn it back into SQL again.

If the changes aren't many you could probably also work from the
results of a normal diff from two text-dumps and glue them back
together into a usable dump file. Or just apply the changes by hand...

All of these methods involve a bit of work and none is foolproof
(unless the dump-diff tool does exist), but if approached well it
could result in a rather useful tool.

Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.

!DSPAM:737,4a6995d910131993413858!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2009-07-24 12:30:01 Re: Copying only incremental records to another DB..
Previous Message Jazz Johal 2009-07-24 10:31:07 Replication from Postgres to EDB