X-Original-To: pgsql-performance@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A0D58475BC3 for ; Fri, 21 Feb 2003 13:09:19 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 28446-08 for ; Fri, 21 Feb 2003 13:09:08 -0500 (EST) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by postgresql.org (Postfix) with ESMTP id C7465475CEE for ; Fri, 21 Feb 2003 13:06:25 -0500 (EST) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.6/8.12.6) with ESMTP id h1LI4wwN024302; Fri, 21 Feb 2003 11:04:58 -0700 (MST) Date: Fri, 21 Feb 2003 10:55:41 -0700 (MST) From: "scott.marlowe" To: Kevin White Cc: Subject: Re: Really bad insert performance: what did I do wrong? In-Reply-To: <3E566022.5010200@digital-ics.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new X-Archive-Number: 200302/159 X-Sequence-Number: 1215 OK, I'm gonna make a couple of observations here that may help out. 1: sun's performance on IDE hardware is abysmal. Both Solaris X86 and Solaris Sparc are utter dogs at IDE, even when you do get DMA and prefetch setup and running. Linux or BSD are much much better at handling IDE interfaces. 2: Postgresql under Solaris on Sparc is about 1/2 as fast as Postgresql under Linux on Sparc, all other things being equal. On 32 bith Sparc the chasm widens even more. 3: Inserting ALL 700,000 rows in one transaction is probably not optimal. Try putting a test in every 1,000 or 10,000 rows to toss a "commit;begin;" pair at the database while loading. Inserting all 700,000 rows at once means postgresql can't recycle the transaction logs, so you'll have 700,000 rows worth of data in the transaction logs waiting for you to commit at the end. That's a fair bit of space, and a large set of files to keep track of. My experience has been that anything over 1,000 inserts in a transaction gains little. 4: If you want to make sure you don't insert any duplicates, it's probably faster to use a unique multi-column key on all your columns (there's a limit on columns in an index depending on which flavor of postgresql you are running, but I think it's 16 on 7.2 and before and 32 on 7.3 and up. I could be off by a factor of two there.