Re: unlogged tables - Mailing list pgsql-hackers

From Greg Stark
Subject Re: unlogged tables
Date
Msg-id AANLkTimucBwh4QRdqf80R5V-7UpwCqbEqT43XjtX_Aob@mail.gmail.com
Whole thread Raw
In response to Re: unlogged tables  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: unlogged tables
List pgsql-hackers
On Sun, Nov 14, 2010 at 1:15 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Cleanup at first connection is something we've been avoiding for years,
> but maybe it's time to bite the bullet and do that?
>

Another alternative is to initialize the unlogged tables when you
first access them. If you try to open a table and there are no files
attached them go ahead and initialize it by creating an empty table
and building any indexes.

Hm, I had been assuming recovery would be responsible for cleaning up
the tables even if the first access is responsible for rebuilding
them. But there's a chance there have been no modifications to them
since the last checkpoint. But in that case the data in them is fine.
It would be a weird interface if it only cleared them out sometimes
based on unpredictable timing though. Avoiding that does require some
kind of alternate storage scheme other than the WAL to indicate what
needs to be cleared out. .init files are as good a mechanism even if
they just mean "unlink this file on startup".

-- 
greg


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: unlogged tables
Next
From: Robert Haas
Date:
Subject: Re: Label switcher function