unlogged tables

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: unlogged tables
Date: 2010-11-14 00:16:30
Message-ID: AANLkTin0tGeMhXXEnDpFv3dpE4KvofV4YkYhM++qy_pe@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Here is a series of three patches related to unlogged tables.

1. The first one (relpersistence-v1) is a mostly mechanical patch that
replaces pg_class.relistemp (a Boolean) with pg_class.relpersistence
(a character), so that we can support more than two values. BE SURE
YOU INITDB, since the old catalog format will not work with this patch
applied.

2. The second one (unlogged-tables-v1) adds support for unlogged
tables by adding a new supported value for relpersistence. I made this
work by having backend that creates an unlogged relation write out an
"init" fork for that relation. The main fork is nuked and replaced by
the contents of the init fork during startup. But I haven't made this
code work yet for index types other than btree, so attempting to
define a non-btree index on an unlogged relation will currently result
in an error. I don't think that's probably too hard to fix, but I
haven't done it yet.

3. The third patch (relax-sync-commit-v1) allows asynchronous commit
even when synchronous_commit=on if the transaction has not written
WAL. Of course, a read-only transaction won't even have an XID and
therefore won't need a commit record, so what this is really doing is
allowing transactions that have written only to temp - or unlogged -
tables to commit asynchronously. This should be OK, because if the
system crashes before the commit record hits the disk, we haven't
really lost anything we wouldn't lose anyway: the temp tables will
disappear on restart, and the unlogged ones will be truncated. This
path actually could be applied independently of the first two, if I
adjusted the comments a bit.

Review and testing would be appreciated.

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

Attachment Content-Type Size
relpersistence-v1.patch application/octet-stream 65.3 KB
unlogged-tables-v1.patch application/octet-stream 52.7 KB
relax-sync-commit-v1.patch application/octet-stream 3.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-11-14 00:41:59 Re: unlogged tables
Previous Message Stefan Kaltenbrunner 2010-11-13 22:45:58 Re: 8.4-vintage problem in postmaster.c