Re: INSERT performance deteriorates quickly during a large import

From: Tomas Vondra <tv(at)fuzzy(dot)cz>
To: Chris Browne <cbbrowne(at)acm(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: INSERT performance deteriorates quickly during a large import
Date: 2007-11-09 20:59:55
Message-ID: 4734CA4B.3040102@fuzzy.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>> Try to one of these:
>>
>> a) don't use INSERT statements, use a COPY instead
>>
>> b) from time to time run ANALYZE on the "public" table (say 1000
>> inserts, then one analyze)
>>
>> c) create the table without constraints (primary / foreign keys in this
>> case), import all the data, and then create the constraints
>>
>> The (b) and (c) may be combined, i.e. import without constraints and
>> analyze from time to time. I'd probably try the (a) at first, anyway.
>>
>> Try to gather some more statistics - is the problem related to CPU or
>> I/O? Use 'dstat' for example - this might say give you a hint in case
>> the advices mentioned above don't help.
>
> I agree with all but b).

You're right - this combination (no constraints or indices and using
ANALYZE at the same time) won't help. The original list of advices was a
little bit different, but I've changed it and haven't checked the
following paragraphs ...

Tomas

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ted Byers 2007-11-09 21:18:17 Re: Optimal time series sampling.
Previous Message Nathan Wilhelmi 2007-11-09 20:00:41 Importance of CPU floating point performance...