Re: GSoC proposal - "make an unlogged table logged"

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Jim Nasby <jim(at)nasby(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: GSoC proposal - "make an unlogged table logged"
Date: 2014-04-03 12:02:27
Message-ID: 533D4DD3.6050303@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 04/03/2014 02:41 PM, Andres Freund wrote:
> On 2014-04-03 13:38:29 +0300, Heikki Linnakangas wrote:
>> On 04/01/2014 08:58 PM, Andres Freund wrote:
>>> On 2014-04-01 12:56:04 -0500, Jim Nasby wrote:
>>>> On 3/4/14, 8:50 AM, Andres Freund wrote:
>>>>> Can't that be solved by just creating the permanent relation in a new
>>>>> relfilenode? That's equivalent to a rewrite, yes, but we need to do that
>>>>> for anything but wal_level=minimal anyway.
>>>>
>>>> Maybe I'm missing something, but doesn't this actually involve writing the data twice? Once into WAL and again into the relation itself?
>>>
>>> Yes. But as I said, that's unavoidable for anything but
>>> wal_level=minimal.
>>
>> Ideally, you would *only* write the data to WAL, when you do ALTER TABLE ...
>> SET LOGGED. There's no fundamental reason you need to rewrite the
>> heap, too.
>
> As another point: What's the advantage of that? The amount of writes
> will be the same, no? It doesn't seem to be all that interesting that
> a second filenode exists temporarily?

Surely it's cheaper to read the whole relation and copy it to just WAL,
than to read the whole relation and write it both the WAL and another file.

(Maybe it's not worth the trouble to avoid it - but that depends on
whether we come up with a good design..)

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2014-04-03 12:21:25 Re: json(b) equality rules
Previous Message Gabriel 2014-04-03 11:50:59 Firing trigger if only