X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 9E351D1E187 for ; Sat, 21 Feb 2004 16:18:27 +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 82729-04 for ; Sat, 21 Feb 2004 12:18:26 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 24109D1E183 for ; Sat, 21 Feb 2004 12:18:26 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i1LGIP1Y003245 for ; Sat, 21 Feb 2004 16:18:25 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i1LFoRB6074954 for pgsql-sql@postgresql.org; Sat, 21 Feb 2004 15:50:27 GMT From: Christopher Browne X-Newsgroups: comp.databases.postgresql.sql Subject: Re: postgresql multiple insert slow Date: Sat, 21 Feb 2004 10:03:53 -0500 Organization: cbbrowne Computing Inc Lines: 20 Message-ID: References: <20040219163238.GD10913@mich2.itxmarket.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org X-message-flag: Outlook is rather hackable, isn't it? X-Home-Page: http://www.cbbrowne.com/info/ X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Security Through Obscurity, linux) Cancel-Lock: sha1:EXVjt12rVbyjYNYrpUqOtk/fT1s= To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/331 X-Sequence-Number: 17021 Centuries ago, Nostradamus foresaw when mich@freebsdcluster.org ("Michael L. Hostbaek") would write: > I runs fine - and I get no errors - but it takes almost 25 minutes to > complete.. I tried running the script while just grabbing the rows from > the oracle database and writing to a text file - and then it only takes > a couple of minutes .. So it must be the INSERT command that chokes - is > there a better way to do it ? > > Any advise much appreciated. The problem here is that each insert implicitly sets up a transaction BEGIN and COMMIT. If you were to wrap the loop with a BEGIN at the start and a COMMIT at the end, you would likely find it would complete much, much faster. -- output = ("cbbrowne" "@" "acm.org") http://www3.sympatico.ca/cbbrowne/wp.html "Java and C++ make you think that the new ideas are like the old ones. Java is the most distressing thing to hit computing since MS-DOS." -- Alan Kay