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