Re: COPY and indices?

From: hamann(dot)w(at)t-online(dot)de
To: pgsql-general(at)postgresql(dot)org
Subject: Re: COPY and indices?
Date: 2012-03-13 06:51:48
Message-ID: 4F5EEE84.mailIIM1PUX40@amadeus3.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Scott Marlowe wrote:
2012/3/12 François Beausoleil <francois(at)teksol(dot)info>:
> Hi all,
>
> When using COPY FROM STDIN to stream thousands of rows (20k and more hourly), what happens with indices? Are they updated only once after the operation, or are they updated once per row? Note that I'm not replacing the table's data: I'm appending to what's already there. I suspect batching writes will be faster than writing each individual row using an INSERT 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Виктор Егоров 2012-03-13 09:16:24 How to find compiled-in default port number?
Previous Message Scott Marlowe 2012-03-13 05:22:49 Re: COPY and indices?