Re: code question: storing INTO relation

From: Kevin Brown <kevin(at)sysexperts(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: code question: storing INTO relation
Date: 2004-11-12 23:49:44
Message-ID: 20041112234944.GA16280@filer
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian wrote:
>
> Added to TODO:
>
> * Eliminate WAL logging for CREATE INDEX/REINDEX/CREATE TABLE AS
> when not doing WAL archiving

But that means that these operations can't be performed in a
transaction unless WAL archiving is on, right? (If I misunderstand
and thus am wrong about this then you can ignore the rest of what
follows, of course)

Suppose I do the following within a transaction with WAL archiving
turned off:

CREATE TABLE blah (x integer primary key, y varchar(32));
INSERT INTO blah SELECT x, y FROM foo;

and then roll it back because something didn't work out the way I
wanted it to.

If CREATE INDEX isn't WAL logged, then either the rollback of the
above will result in an inconsistent database, or the fact that CREATE
INDEX isn't WAL logged will cause the CREATE TABLE to fail because the
index creation (and thus the table creation) can't be done within a
transaction.

Being able to do DDL within a transaction is one of the coolest and
(from the POV of a DBA) most useful features of the database. If
we're going to eliminate WAL logging of certain operations, it should
be done at the explicit request of the DBA, preferably through a GUC,
and preferably with a relevant GUC for each operation.

Since WAL archiving requires that the operations in question be WAL
logged, the GUCs that control WAL logging of those statements would
clearly be ineffective if WAL archiving is turned on.

--
Kevin Brown kevin(at)sysexperts(dot)com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2004-11-13 00:04:35 Re: 8.0 press release
Previous Message Oleg Bartunov 2004-11-12 23:40:40 Re: 8.0 press release