Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 720489FB42C for ; Fri, 13 Oct 2006 06:01:10 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 66033-05 for ; Fri, 13 Oct 2006 09:01:00 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by postgresql.org (Postfix) with ESMTP id 48F069FB40D for ; Fri, 13 Oct 2006 06:01:00 -0300 (ADT) Received: from [194.25.154.138] (helo=webserv.wug.de) by mrelayeu.kundenserver.de (node=mrelayeu1) with ESMTP (Nemesis), id 0MKwpI-1GYIuX3m8R-0004Ws; Fri, 13 Oct 2006 11:00:58 +0200 Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) id 1GYIuX-0000QH-00 for pgsql-general@postgresql.org; Fri, 13 Oct 2006 11:00:57 +0200 Date: Fri, 13 Oct 2006 11:00:57 +0200 From: "A. Kretschmer" To: pgsql-general@postgresql.org Subject: Re: Performance Problem Message-ID: <20061013090057.GG27503@a-kretschmer.de> References: <20061013052628.7600.qmail@web50802.mail.yahoo.com> <20061013082210.GE1896@svana.org> <200610130155.06831.uwe@oss4u.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200610130155.06831.uwe@oss4u.com> User-Agent: Mutt/1.5.9i X-Provags-ID: kundenserver.de abuse@kundenserver.de login:51ea9561fc3f6d9539a2acd743e4748c X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200610/559 X-Sequence-Number: 102085 am Fri, dem 13.10.2006, um 1:55:06 -0700 mailte Uwe C. Schroeder folgendes: > > Does the table you're inserting into have indexes or foreign keys? > > Either of those slow down loading considerably. One commen workaround > > is to drop the indexes and constraints, load the data and re-add them. > > Why do you COPY the data into a temporary table just to do a "insert into > org_table (select * from temp_table);" ? Since you're copying ALL records > anyways, why don't you just copy the data into the "org_table" directly? Perhaps he want to modify the data in this temp. table? > > Also look for the "autocommit" setting. If autocommit is on, every insert is a > transaction on it's own - leading to a lot of overhead. Turning autocommit > off and running the inserts in batches of - say 1000 inserts per transaction > - will increase speed considerably. A 'insert into org_table (select * from temp_table);' is only ONE transaction. Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47215, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net