Re: Using multi-row technique with COPY - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Using multi-row technique with COPY
Date
Msg-id 9522.1133188012@sss.pgh.pa.us
Whole thread Raw
In response to Re: Using multi-row technique with COPY  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: Using multi-row technique with COPY
List pgsql-hackers
Alvaro Herrera <alvherre@commandprompt.com> writes:
> I don't see why couldn't have an additional index access method entry
> point to insert multiple rows on one call.

I think Simon was mainly on about the idea of inserting multiple *heap*
entries with one call, ie, only one cycle of locking a heap buffer.
It's not apparent to me that there'd be any noticeable win from batching
index insertions, because even if the heap entries are all on one page,
it's unlikely their index entries would be.

I'm a bit dubious about the whole thing from a concurrency standpoint,
too: holding locks longer is not a great thing in general.  The recent
patch to avoid repeated locking cycles during a read seems OK, because
(1) checking visibility of a tuple is ordinarily pretty cheap, and
(2) it's only a shared lock so other people can be doing the same thing
concurrently.  However, heap insertion can make neither of those claims.
You're talking about an exclusive lock, and you're talking about holding
it while copying data around and then making multiple WAL entries.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Atsushi Ogawa
Date:
Subject: Allow an alias for the target table in UPDATE
Next
From: "R, Rajesh (STSD)"
Date:
Subject: Ipv6 and Postgresql 8.0.3