Re: [GENERAL] Move rows from one database to other

Поиск
Список
Период
Сортировка
От Francisco Olarte
Тема Re: [GENERAL] Move rows from one database to other
Дата
Msg-id CA+bJJbz7MCWVXZUyPJFSr2nV3NT0b3QGwW369NwXtnNNcCq57A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [GENERAL] Move rows from one database to other  (Thomas Güttler <guettliml@thomas-guettler.de>)
Ответы Re: [GENERAL] Move rows from one database to other
Re: [GENERAL] Move rows from one database to other
Список pgsql-general
Thomas:

On Wed, Feb 22, 2017 at 1:51 PM, Thomas Güttler
<guettliml@thomas-guettler.de> wrote:
> I want to **move** the data. The data should get deleted on the satellite
> after transfer.
> I don't know how to delete the data which was copied, since inserts can
> happen during the copy statement.

Depending on the structure / control / kind of ops you have on the
satellite you can try a two-table trick, similar to a common one used
to process files in spool directories.

1st, you move everything to a holding table transactionally in the
satellite ( insert into holding table delete from main table returning
* )

Then you have the holding table to transfer and clear, not touched by
anyone ( as transfer process is the only one touching it )

You can do some tricks. You could inherit holding from main if you
want to be able to see data while it is been transferred. Or play
renaming tricks. It all depends in the concrete app, but you can try
to fit the pattern in it, I've done it several times and its a useful
one.

Francisco Olarte.


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

Предыдущее
От: dinesh kumar
Дата:
Сообщение: Re: [GENERAL] Postgres HA
Следующее
От: Ertan Küçükoğlu
Дата:
Сообщение: [GENERAL] Latest PostgreSQL on Raspbian Jessie