Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id E7AC49FB2EE for ; Tue, 6 Feb 2007 14:31:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 50055-01 for ; Tue, 6 Feb 2007 14:31:22 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) by postgresql.org (Postfix) with ESMTP id 42A929FB30E for ; Tue, 6 Feb 2007 14:31:29 -0400 (AST) Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP with MS-WebStorage 6.0.6249 Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; 06 Feb 2007 10:31:26 -0800 Subject: Re: How long should it take to insert 200,000 records? From: Mark Lewis To: Merlin Moncure Cc: Scott Marlowe , Karen Hill , pgsql-performance@postgresql.org In-Reply-To: References: <1170722158.973141.208230@j27g2000cwj.googlegroups.com> <1170778484.5451.97.camel@state.g2switchworks.com> <1170780953.5451.99.camel@state.g2switchworks.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: MIR3, Inc. Date: Tue, 06 Feb 2007 10:31:26 -0800 Message-Id: <1170786686.16656.484.camel@archimedes> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-27.rhel4.6) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200702/70 X-Sequence-Number: 23124 On Tue, 2007-02-06 at 12:01 -0500, Merlin Moncure wrote: > On 2/6/07, Scott Marlowe wrote: > > On Tue, 2007-02-06 at 10:40, Merlin Moncure wrote: > > > On 2/6/07, Scott Marlowe wrote: > > > > On Mon, 2007-02-05 at 18:35, Karen Hill wrote: > > > > > I have a pl/pgsql function that is inserting 200,000 records for > > > > > testing purposes. What is the expected time frame for this operation > > > > > on a pc with 1/2 a gig of ram and a 7200 RPM disk? The processor is > > > > > a 2ghz cpu. So far I've been sitting here for about 2 million ms > > > > > waiting for it to complete, and I'm not sure how many inserts postgres > > > > > is doing per second. > > > > > > > > That really depends. Doing 200,000 inserts as individual transactions > > > > will be fairly slow. Since PostgreSQL generally runs in autocommit > > > > mode, this means that if you didn't expressly begin a transaction, you > > > > are in fact inserting each row as a transaction. i.e. this: > > > > > > I think OP is doing insertion inside a pl/pgsql loop...transaction is > > > implied here. > > > > Yeah, I noticed that about 10 seconds after hitting send... :) > > actually, I get the stupid award also because RI check to unindexed > column is not possible :) (this haunts deletes, not inserts). Sure it's possible: CREATE TABLE parent (col1 int4); -- insert many millions of rows into parent CREATE TABLE child (col1 int4 REFERENCES parent(col1)); -- insert many millions of rows into child, very very slowly. - Mark Lewis