Received: from localhost (unknown [200.46.204.184]) by developer.postgresql.org (Postfix) with ESMTP id 6B32E2E0071 for ; Tue, 8 Apr 2008 10:53:45 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 83396-03-6 for ; Tue, 8 Apr 2008 10:53:13 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by developer.postgresql.org (Postfix) with ESMTP id D098B2E00A2 for ; Tue, 8 Apr 2008 10:50:52 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1JjEDo-00073u-Pe for pgsql-performance@postgresql.org; Tue, 08 Apr 2008 13:50:48 +0000 Received: from frigga.summersault.com ([12.161.105.138]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 08 Apr 2008 13:50:48 +0000 Received: from mark by frigga.summersault.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 08 Apr 2008 13:50:48 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-performance@postgresql.org From: Mark Stosberg Subject: Re: bulk insert performance problem Date: Tue, 08 Apr 2008 09:50:40 -0400 Lines: 24 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: frigga.summersault.com User-Agent: Thunderbird 2.0.0.12 (X11/20080227) In-Reply-To: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200804/89 X-Sequence-Number: 29582 Christian Bourque wrote: > > Any idea? Is there any other improvements I could do? Are you using the "COPY" syntax in the import script or individual insert statements? Using COPY will always be *much* faster. I believe COPY always appends to tables rather than replacing the contents, you can combine this technique with the possibility of splitting up the task into multiple copy statements, but that has never been necessary in my case, switching from INSERTS to a COPY statement always provided the huge performance improvement I needed. It's easy to confuse "pg_dump -d" with "psql -d" ...it's too bad they mean very different things. For pg_dump, "-d" causes INSERT statements to be generated instead of a COPY statement, and is has been a mistake I made in the past, because I expected to work like "psql -d", where "-d" means "database name". I suppose the safe thing to do is to avoid using "-d" altogether! Mark