X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 55C7ED1B4C0 for ; Tue, 3 Feb 2004 10:58:01 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 63059-02 for ; Tue, 3 Feb 2004 06:57:45 -0400 (AST) Received: from filer (c-24-6-183-218.client.comcast.net [24.6.183.218]) by svr1.postgresql.org (Postfix) with ESMTP id B64A3D1D342 for ; Tue, 3 Feb 2004 06:57:43 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) (uid 1000) by filer with local; Tue, 03 Feb 2004 02:57:46 -0800 Date: Tue, 3 Feb 2004 02:57:46 -0800 From: Kevin Brown To: pgsql-hackers@postgresql.org Subject: Re: COPY from question Message-ID: <20040203105746.GE2608@filer> Mail-Followup-To: Kevin Brown , pgsql-hackers@postgresql.org References: <1070584326.18838.235.camel@cletus.lyris.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline In-Reply-To: Organization: Frobozzco International User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/85 X-Sequence-Number: 49674 Slavisa Garic wrote: > Using pg module in python I am trying to run the COPY command to populate > the large table. I am using this to replace the INSERT which takes about > few hours to add 70000 entries where copy takes minute and a half. That difference in speed seems quite large. Too large. Are you batching your INSERTs into transactions (you should be in order to get good performance)? Do you have a ton of indexes on the table? Does it have triggers on it or some other thing (if so then COPY may well wind up doing the wrong thing since the triggers won't fire for the rows it inserts)? I don't know what kind of schema you're using, but it takes perhaps a couple of hours to insert 2.5 million rows on my system. But the rows in my schema may be much smaller than yours. -- Kevin Brown kevin@sysexperts.com