Re: Inserting heap tuples in bulk in COPY - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Inserting heap tuples in bulk in COPY
Date
Msg-id 4E708759.40206@enterprisedb.com
Whole thread Raw
In response to Re: Inserting heap tuples in bulk in COPY  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Inserting heap tuples in bulk in COPY
Re: Inserting heap tuples in bulk in COPY
List pgsql-hackers
On 13.08.2011 17:33, Tom Lane wrote:
> Heikki Linnakangas<heikki.linnakangas@enterprisedb.com>  writes:
>> The patch is WIP, mainly because I didn't write the WAL replay routines
>> yet, but please let me know if you see any issues.
>
> Why do you need new WAL replay routines?  Can't you just use the existing
> XLOG_HEAP_NEWPAGE support?
>
> By any large, I think we should be avoiding special-purpose WAL entries
> as much as possible.

I tried that, but most of the reduction in WAL-size melts away with
that. And if the page you're copying to is not empty, logging the whole
page is even more expensive. You'd need to fall back to retail inserts
in that case which complicates the logic.

> Also, I strongly object to turning regular heap_insert into a wrapper
> around some other more complicated operation.  That will likely have
> bad consequences for the performance of every other operation.

Ok. I doubt it makes any noticeable difference for performance, but
having done that, it's more readable, too, to duplicate the code.

Attached is a new version of the patch. It is now complete, including
WAL replay code.

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

Attachment

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: unite recovery.conf and postgresql.conf
Next
From: Kaare Rasmussen
Date:
Subject: Re: What Would You Like To Do?