Re: COPY and indices? - Mailing list pgsql-general

From hamann.w@t-online.de
Subject Re: COPY and indices?
Date
Msg-id 4F5EEE84.mailIIM1PUX40@amadeus3.local
Whole thread Raw
In response to COPY and indices?  (François Beausoleil <francois@teksol.info>)
Responses Re: COPY and indices?
List pgsql-general
Scott Marlowe wrote:
2012/3/12 François Beausoleil <francois@teksol.info>:
> Hi all,
>
> When using COPY FROM STDIN to stream thousands of rows (20k and more hourly), what happens with indices? Are they
updatedonly once after the operation, or are they updated once per row? Note that I'm not replacing the table's data:
I'mappending to what's already there. I suspect batching writes will be faster than writing each individual row using
anINSERT statement. 

Copy is faster, but if a single row fails (dup key etc) the whole copy fails.

Hi Scott,

my impression: it would be even faster to drop the indices, do the bulk copy,
and rebuild the indices after the fact.

Regards
Wolfgang Hamann

pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: COPY and indices?
Next
From: Виктор Егоров
Date:
Subject: How to find compiled-in default port number?