Unloading a table consistently

Поиск
Список
Период
Сортировка
От Christophe
Тема Unloading a table consistently
Дата
Msg-id 67F28F8F-CDB5-4F1C-839E-956BF2EA8A6F@thebuild.com
обсуждение исходный текст
Ответы Re: Unloading a table consistently
Re: Unloading a table consistently
Список pgsql-general
Hi,

I will have a log table which, once a day or so, is copied to a file
(for movement to a data warehouse), and the log table emptied.  For
performance, the log table on the production system has no indexes,
and is write-only.  (The unload process is the only reader.)

To unload it, I will be doing:

BEGIN;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
COPY log TO 'filename-path';
TRUNCATE log;
COMMIT;

My understanding is that I need the SERIALIZABLE isolation level so
that the COPY and TRUNCATE see exactly the same view of the table.
Obviously, I don't want to lose data by having the TRUNCATE delete
records that appeared while the COPY was executing.  Is that
correct?  Is there a better way to handle this kind of thing that I'm
missing?

Thanks!
-- Xof

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

Предыдущее
От: Sanjaya Kumar Patel
Дата:
Сообщение: Re: High resolution PostgreSQL Logo
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Unloading a table consistently