Re: general questions postgresql performance config - Mailing list pgsql-general

From Greg Smith
Subject Re: general questions postgresql performance config
Date
Msg-id 4B5F6B19.3090804@2ndquadrant.com
Whole thread Raw
In response to Re: general questions postgresql performance config  (Andy Colson <andy@squeakycode.net>)
List pgsql-general
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


pgsql-general by date:

Previous
From: Greg Smith
Date:
Subject: Re: 100% of CPU utilization postgres process
Next
From: steeles@gmail.com
Date:
Subject: Re: pg dump.. issue with when using crontab