Andy Colson wrote:
> I recall seeing someplace that you can avoid WAL if you start a
> transaction, then truncate the table, then start a COPY.
>
> Is that correct? Still hold true? Would it make a lot of difference?
That is correct, still true, and can make a moderate amount of
difference if the WAL is really your bottleneck. More of a tweak for
loading small to medium size things as I see it. Once the database and
possibly its indexes get large enough, the loading time starts being
dominated by handling all that work, with its random I/O, rather than
being limited by the sequential writes to the WAL. It's certainly a
useful optimization to take advantage of when you can, given that it's
as easy as:
BEGIN;
TRUNCATE TABLE x;
COPY x FROM ... ;
COMMIT;
--
Greg Smith 2ndQuadrant Baltimore, MD
PostgreSQL Training, Services and Support
greg@2ndQuadrant.com www.2ndQuadrant.com