Re: COPY with no WAL, in certain circumstances

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgresql(dot)org, Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
Cc: pgsql-patches(at)postgresql(dot)org, "Simon Riggs" <simon(at)2ndquadrant(dot)com>, "Bruce Momjian" <bruce(at)momjian(dot)us>, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Subject: Re: COPY with no WAL, in certain circumstances
Date: 2007-01-07 02:32:43
Message-ID: 2164.1168137163@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Robert Treat <xzilla(at)users(dot)sourceforge(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2007-01-07 02:37:47 Re: COPY with no WAL, in certain circumstances
Previous Message Tom Lane 2007-01-07 02:27:55 Re: pg_ctl options

Browse pgsql-patches by date

  From Date Subject
Next Message Joshua D. Drake 2007-01-07 02:37:47 Re: COPY with no WAL, in certain circumstances
Previous Message Tom Lane 2007-01-07 02:20:53 Re: COPY with no WAL, in certain circumstances