X-Original-To: pgsql-admin@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A949647621C for ; Tue, 13 May 2003 00:47:02 -0400 (EDT) Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net [194.217.242.85]) by postgresql.org (Postfix) with ESMTP id DD92A474E42 for ; Tue, 13 May 2003 00:47:01 -0400 (EDT) Received: from lfix.demon.co.uk ([158.152.59.127] helo=linda.lfix.co.uk) by anchor-post-35.mail.demon.net with esmtp (Exim 3.36 #2) id 19FRgw-00054X-0Z; Tue, 13 May 2003 05:47:06 +0100 Received: from localhost ([127.0.0.1] ident=olly) by linda.lfix.co.uk with esmtp (Exim 3.36 #1 (Debian)) id 19FRgv-00065E-00; Tue, 13 May 2003 05:47:05 +0100 Subject: Re: No flamefest please, MySQL vs. PostgreSQL AGAIN From: Oliver Elphick To: timeless postgres Cc: Tom Lane , pgsql-admin@postgresql.org In-Reply-To: <1052780562.25329.36.camel@timetop> References: <1052721342.17601.118.camel@timetop> <8851.1052749960@sss.pgh.pa.us> <1052780562.25329.36.camel@timetop> Content-Type: text/plain Organization: LFIX Limited Message-Id: <1052801225.18713.28.camel@linda.lfix.co.uk> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 13 May 2003 05:47:05 +0100 Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=-32.9 required=5.0 tests=BAYES_01,IN_REP_TO,QUOTED_EMAIL_TEXT,QUOTE_TWICE_1, REFERENCES,REPLY_WITH_QUOTES,USER_AGENT_XIMIAN autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/146 X-Sequence-Number: 8708 On Tue, 2003-05-13 at 00:02, timeless postgres wrote: ... > Maybe I don't understand how to ask the question. I want to know how to > insert (say) 10M rows into a table quickly. I mean... VERY quickly. > > Obviously the following 10M transactions are going to be slow: > > insert into tab values (1); > insert into tab values (2); > insert into tab values (3); > . . . > insert into tab values (10000000); > > Would it be faster if I put a single transaction around that? 10M transactions are going to be slow. 10M inserts in one transaction or in a few transactions will be a lot faster. > Would it > be faster to do the following? > > copy tab (col) from stdin; > 1 > 2 > 3 > . . . > 10000000 > \. Yes, that will be the fastest of all. > > It should be noted though that as of > > 7.3, operations on TEMP tables don't do WAL logging; perhaps that > > would be of use to you. > > It does sound useful, on new tables, to load into a temp table, then > rename the temp table as permanent table. I don't think that is possible. -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "Watch ye and pray, lest ye enter into temptation. The spirit truly is ready, but the flesh is weak." Mark 14:38