Skip site navigation (1) Skip section navigation (2)

Re: WAL logging volume and CREATE TABLE

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: WAL logging volume and CREATE TABLE
Date: 2011-08-02 14:27:13
Message-ID: 4E380941.8080901@enterprisedb.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On 02.08.2011 16:34, Bruce Momjian wrote:
> Our docs suggest an optimization to reduce WAL logging when you are
> creating and populating a table:
>
> 	http://www.postgresql.org/docs/9.0/static/runtime-config-wal.html#RUNTIME-CONFIG-WAL-SETTINGS
> 	
> 	In minimal level, WAL-logging of some bulk operations, like CREATE
> 	INDEX, CLUSTER and COPY on a table that was created or truncated in the
> 	same transaction can be safely skipped, which can make those operations
> 	much faster (see Section 14.4.7). But minimal WAL does not contain
> 	enough information to reconstruct the data from a base backup and the
> 	WAL logs, so either archive or hot_standby level must be used to enable
> 	WAL archiving (archive_mode) and streaming replication.
>
> I am confused why we issue significant WAL traffic for CREATE INDEX?
> Isn't the index either created or removed if the transaction fails?
> What crash recovery activity state do we need WAL logging for?  I
> realize we have to do WAL logging for streaming replication, but CREATE
> TABLE isn't going to affect that.   I also realize the index has to be
> on disk on commit, but the same is true for doing the CREATE TABLE in
> the same transaction block.

I'm confused about what you're confused about. Crash recovery doesn't 
need the WAL for CREATE INDEX, but WAL archiving does.

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2011-08-02 14:52:44
Subject: Re: WAL logging volume and CREATE TABLE
Previous:From: Merlin MoncureDate: 2011-08-02 14:02:05
Subject: Re: WAL logging volume and CREATE TABLE

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group