Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 860179FBF84 for ; Tue, 8 May 2007 21:22:50 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 98674-05 for ; Tue, 8 May 2007 21:22:44 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 529679FB78C for ; Tue, 8 May 2007 21:22:47 -0300 (ADT) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Wed, 9 May 2007 00:22:45 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 08 May 2007 19:22:45 -0500 Subject: Re: From: Scott Marlowe To: Orhan Aglagul Cc: pgsql-performance@postgresql.org In-Reply-To: <868BCE5A6576F44A862F1FBBC3E14A01042559C3@ms17.mse9.exchange.ms> References: <868BCE5A6576F44A862F1FBBC3E14A01042559C3@ms17.mse9.exchange.ms> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1178670165.7497.42.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Tue, 08 May 2007 19:22:45 -0500 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/162 X-Sequence-Number: 24552 On Tue, 2007-05-08 at 17:59, Orhan Aglagul wrote: > Hi Everybody, > > I was trying to see how many inserts per seconds my application could > handle on various machines. > > Those are the machines I used to run my app: > > > > 1) Pentium M 1.7Ghz > > 2) Pentium 4 2.4 Ghz > > 3) DMP Xeon 3Ghz > > > > Sure, I was expecting the dual Zeon to outperform the Pentium M and 4. > But the data showed the opposite. > > So, I wrote a simple program (in C) using the libpq.so.5 which opens a > connection to the database (DB in localhost), > > Creates a Prepared statement for the insert and does a 10,000 insert. > The result did not change. > > > > Only after setting fsync to off in the config file, the amount of time > to insert 10,000 records was acceptable. > > > > Here is the data: > > > > Time for 10000 inserts > > Fsync=on > > Fsync=off > > Pentium M 1.7 > > ~17 sec > > ~6 sec > > Pentium 4 2.4 > > ~13 sec > > ~11 sec > > Dual Xeon > > ~65 sec > > ~1.9 sec > > > > > I read that postgres does have issues with MP Xeon (costly context > switching). But I still think that with fsync=on 65 seconds is > ridiculous. > > > > Can anybody direct me to some improved/acceptable performance with > fsync=on? I'm guessing you didn't do the inserts inside a single transaction, which means that each insert was it's own transaction. Try doing them all in a transaction. I ran this simple php script: and it finished in 3.5 seconds on my workstation (nothing special)