Re: code question: storing INTO relation - Mailing list pgsql-hackers

From Kevin Brown
Subject Re: code question: storing INTO relation
Date
Msg-id 20041112234944.GA16280@filer
Whole thread Raw
In response to Re: code question: storing INTO relation  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: code question: storing INTO relation  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
List 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@sysexperts.com


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: code question: storing INTO relation
Next
From: Alvaro Herrera
Date:
Subject: Re: code question: storing INTO relation