Re: Skip WAL in ALTER TABLE - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Skip WAL in ALTER TABLE
Date
Msg-id 4AF172A9.4020202@enterprisedb.com
Whole thread Raw
In response to Re: Skip WAL in ALTER TABLE  (Simon Riggs <simon@2ndQuadrant.com>)
List pgsql-hackers
Simon Riggs wrote:
> On Thu, 2009-10-15 at 13:18 +0900, Itagaki Takahiro wrote:
>> Simon Riggs <simon@2ndQuadrant.com> wrote:
>>
>>>> Is it possible to use WAL-skipping and BulkInsertState in ATRewriteTable() ?
>>>> If ok, I'll submit a patch for the next commitfest.
>>> Yes
>> Patch attached.
>> This patch skip WAL writes during table rewrites from ALTER TABLE.
> 
> Looks fine to me, apart from
> 
>  if (!XLogArchivingActive() || newrel->rd_istemp)
>     hi_options |= HEAP_INSERT_SKIP_WAL;
> 
> I think the second condition is unnecessary, so just
> 
>  if (!XLogArchivingActive())
>     hi_options |= HEAP_INSERT_SKIP_WAL;
> 
> which is what COPY does. Temp tables are excluded in heap_insert()

Yep.

Committed with the above and some other small changes. I moved the
initialization of BulkInsertState and hi_options outside the if-block.
Feels clearer this way, and they're only needed if newrel==true, not if
only needscan==true.

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


pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: [BUGS] BUG #4961: pg_standby.exe crashes with no args
Next
From: Heikki Linnakangas
Date:
Subject: Re: [BUGS] BUG #4961: pg_standby.exe crashes with no args