Re: [PATCHES] COPY with no WAL, in certain circumstances - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCHES] COPY with no WAL, in certain circumstances
Date
Msg-id 2164.1168137163@sss.pgh.pa.us
Whole thread Raw
Responses Re: [PATCHES] COPY with no WAL, in certain circumstances  ("Joshua D. Drake" <jd@commandprompt.com>)
Re: [PATCHES] COPY with no WAL, in certain circumstances  ("Simon Riggs" <simon@2ndquadrant.com>)
List pgsql-hackers
Robert Treat <xzilla@users.sourceforge.net> writes:
> On Saturday 06 January 2007 16:36, Simon Riggs wrote:
> <snip>
>> BEGIN;
>> CREATE TABLE foo...
>> INSERT INTO foo    --uses WAL
>> COPY foo..    --no WAL
>> INSERT INTO foo    --uses WAL
>> COPY foo..    --no WAL
>> INSERT INTO foo    --uses WAL
>> COPY foo...    --no WAL
>> COMMIT;

> Is there some technical reason that the INSERT statements need to use WAL in
> these scenarios?

First, there's enough other overhead to an INSERT that you'd not save
much percentagewise.  Second, not using WAL doesn't come for free: the
cost is having to fsync the whole table afterwards.  So it really only
makes sense for commands that one can expect are writing pretty much
all of the table.  I could easily see it being a net loss for individual
INSERTs.

            regards, tom lane

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_ctl options
Next
From: "Joshua D. Drake"
Date:
Subject: Re: [PATCHES] COPY with no WAL, in certain circumstances