Search Postgresql Archives

Re: INSERT performance deteriorates quickly during a large import

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux