Insert performance for large transaction with multiple COPY FROM - Mailing list pgsql-performance

From Jeff Janes
Subject Insert performance for large transaction with multiple COPY FROM
Date
Msg-id CAMkU=1zx2MXdT+za1PokYc5SZEe4j=qaHG8GuG=13UOQ3oRScQ@mail.gmail.com
Whole thread Raw
In response to Insert performance for large transaction with multiple COPY FROM  (Horst Dehmer <horst.dehmer@gmail.com>)
Responses Re: Insert performance for large transaction with multiple COPY FROM  (Horst Dehmer <horst.dehmer@gmail.com>)
List pgsql-performance
On Friday, January 11, 2013, Horst Dehmer wrote:

Except - and that's the wall I'm hitting - for one table which yielded just 75 records/second.
The main 'problem' seem to be the FK constraints. Dropping just them restored insert performance for this table to 6k records/s.

It sure sounds like you don't have enough RAM to hold the foreign-key table data needed to check the constraints, so every insert needs one disk revolution to fetch the data.

If you drop the indexes and constraints one at a time until it speeds up, is there a certain one that is the culprit? 

You can look in pg_statio_user_tables to see what tables and indexes have high io being driven by the bulk loading.

Use "top" to see of the server is mostly IO bound or CPU bound.

Cheers,

Jeff

pgsql-performance by date:

Previous
From: Horst Dehmer
Date:
Subject: Insert performance for large transaction with multiple COPY FROM
Next
From: Claudio Freire
Date:
Subject: Re: Insert performance for large transaction with multiple COPY FROM