Re: Sync 2 tables in 2 databases

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: Sync 2 tables in 2 databases
Дата
Msg-id dcc563d10903111223j11318655y348d221a09b93f7c@mail.gmail.com
обсуждение исходный текст
Ответ на Sync 2 tables in 2 databases  (SHARMILA JOTHIRAJAH <sharmi_jo@yahoo.com>)
Список pgsql-general
On Wed, Mar 11, 2009 at 1:20 PM, SHARMILA JOTHIRAJAH
<sharmi_jo@yahoo.com> wrote:
>
> Hi,
> I have 2 postgres databases with similar structure. I want to keep some tables in sync in these 2 databases(They can
besynced just once a day). Is there a way to archive this using function ? 
> Something like....
>
>  Select syncTable('foo')
>
> where syncTable is a function that compares table 'foo' in db1 with table 'foo' in db2 and make
changes(update/insert/delete)to 'foo' in db1 

You can either truncate it on the destination db every so often, then
dump / restore the data back into it, drop it and restore it, write a
simple replication script that looks for missing  / updated rows, or
my suggestion, set up replication with slony and be done with it.  Of
course, you don't mention if you need one or two way synchronization,
which makes a big difference in how you choose to do things.

В списке pgsql-general по дате отправления:

Предыдущее
От: SHARMILA JOTHIRAJAH
Дата:
Сообщение: Sync 2 tables in 2 databases
Следующее
От: SHARMILA JOTHIRAJAH
Дата:
Сообщение: Re: Sync 2 tables in 2 databases