Re: unlogged tables - Mailing list pgsql-hackers

From Robert Haas
Subject Re: unlogged tables
Date
Msg-id AANLkTi=innyY6LDoQw14b8UC_dr_zZ9KPudjbvg6ByBj@mail.gmail.com
Whole thread Raw
In response to unlogged tables  (Andy Colson <andy@squeakycode.net>)
Responses Re: unlogged tables  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Tue, Nov 30, 2010 at 10:36 PM, Andy Colson <andy@squeakycode.net> wrote:
> [ review ]

Currently, if you create an unlogged table, restart PG, and vacuum the
table, you'll get this:

rhaas=# vacuum unlogged;
WARNING:  relation "unlogged" page 0 is uninitialized --- fixing
VACUUM

The reason this happens is because the init fork of an unlogged heap
consists of a single empty page, rather than a totally empty file.  I
needed to WAL-log the creation of the init fork, and there's currently
no way to WAL-log the creation of an empty file other than the main
relation fork.  I figured a file with one empty page would be just as
good as a totally empty file, and that way I could piggyback on
XLOG_HEAP_NEWPAGE, which will automatically create the relation fork
if it's not already there.  However, as the above warning message
demonstrates, this was a bit too clever.

One possible fix is to change the XLOG_SMGR_CREATE record to carry a
fork number.  Does that seem reasonable, or would anyone like to
recommend another approach?

I'm also going to go through and change all instances of the word
"unlogged" to "volatile", per previous discussion.  If this seems like
a bad idea to anyone, please object now rather than afterwards.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: "Erik Rijkers"
Date:
Subject: Re: Fwd: new patch of MERGE (merge_204) & a question about duplicated ctid
Next
From: Pavel Stehule
Date:
Subject: Re: Feature request - CREATE TYPE ... WITH OID = oid_number.