COPY and indices?

From: François Beausoleil <francois(at)teksol(dot)info>
To: pgsql-general(at)postgresql(dot)org
Subject: COPY and indices?
Date: 2012-03-13 04:11:55
Message-ID: C8BEDF5300864831BD72C47E1F1E9B9F@ftml.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

Currently, I can sustain 30-40 writes per second on a Rackspace VPS. I know it's not the ideal solution, but that's what I'm working with. Following vmstat, the server is spending 30 to 40% of it's time in iowait. I don't have measurements as to what files are touched, and I'd welcome suggestions to measure the time PostgreSQL actually spends writing indices vs data.

Thanks!
François

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ondrej Ivanič 2012-03-13 04:36:54 Re: COPY and indices?
Previous Message John R Pierce 2012-03-13 01:13:11 Re: Upgrade questions