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 4E45A6F7.6070906@enterprisedb.com
Whole thread Raw
In response to Re: Inserting heap tuples in bulk in COPY  (Merlin Moncure <mmoncure@gmail.com>)
Responses Re: Inserting heap tuples in bulk in COPY
List pgsql-hackers
On 13.08.2011 00:26, Merlin Moncure wrote:
> On Fri, Aug 12, 2011 at 2:16 PM, Heikki Linnakangas
> <heikki.linnakangas@enterprisedb.com>  wrote:
>> Triggers complicate this. I believe it is only safe to group tuples together
>> like this if the table has no triggers. A BEFORE ROW trigger might run a
>> SELECT on the table being copied to, and check if some of the tuples we're
>> about to insert exist. If we run BEFORE ROW triggers for a bunch of tuples
>> first, and only then insert them, none of the trigger invocations will see
>> the other rows as inserted yet. Similarly, if we run AFTER ROW triggers
>> after inserting a bunch of tuples, the trigger for each of the insertions
>> would see all the inserted rows. So at least for now, the patch simply falls
>> back to inserting one row at a time if there are any triggers on the table.
>
> But generic RI triggers would be ok, right?

RI triggers are AFTER ROW triggers, which we concluded to be OK after 
all, so they would be ok.

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


pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Inserting heap tuples in bulk in COPY
Next
From: daveg
Date:
Subject: Re: VACUUM FULL versus system catalog cache invalidation