Re: Inserting heap tuples in bulk in COPY

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Inserting heap tuples in bulk in COPY
Date: 2011-09-14 10:52:09
Message-ID: 4E708759.40206@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 13.08.2011 17:33, Tom Lane wrote:
> Heikki Linnakangas<heikki(dot)linnakangas(at)enterprisedb(dot)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 Content-Type Size
copy-heap-multi-insert-2.patch text/x-diff 24.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-09-14 12:07:26 Re: augmenting MultiXacts to improve foreign keys
Previous Message Kaare Rasmussen 2011-09-14 10:49:24 Re: What Would You Like To Do?