Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id A93BF9FB4B5 for ; Tue, 6 Mar 2007 03:53:36 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 11353-09 for ; Tue, 6 Mar 2007 03:53:25 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.169]) by postgresql.org (Postfix) with ESMTP id 6F1F49FA4E5 for ; Tue, 6 Mar 2007 03:53:32 -0400 (AST) Received: by ug-out-1314.google.com with SMTP id k3so100577ugf for ; Mon, 05 Mar 2007 23:53:31 -0800 (PST) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:subject:from:to:cc:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding; b=Sbx+MULKC5Pu3s4siooQygt1v0RXLdXdymZ/gpeiAsY4HhROHOlzEkPuxabmbe1IFXk2HklSMwaDq94cXlFpqyPY1RCkpGrmhbeUmqIASanp2Wr/yOPbZUXxjMXKQC6RmVmzZH17tPqfBPCMjZj3XW3Vc02xBFTZ9K35H8rGSPw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:subject:from:to:cc:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding; b=lNG5Dtp9iRqA/9JEIivLyfzHLE4/OtBYWqMOXMVNkrwCFnw1N7YwC7dIq7ttg66rey43PWPwfe/9r3klGMT2SG/lLGMBs5Uq3bAOp7WWZ0pc056DscVWWq1yUQdt7KVehk7GRCXfAo73Wh0rYQXAhYYAzxyEBwkniZqRgMWMQ6I= Received: by 10.67.22.7 with SMTP id z7mr1044262ugi.1173167611018; Mon, 05 Mar 2007 23:53:31 -0800 (PST) Received: from ?10.192.57.85? ( [193.134.216.2]) by mx.google.com with ESMTP id i5sm29021104mue.2007.03.05.23.53.29; Mon, 05 Mar 2007 23:53:29 -0800 (PST) Subject: Re: Insert performance From: =?ISO-8859-1?Q?jo=EBl?= Winteregg To: Richard Huxton Cc: pgsql-performance@postgresql.org In-Reply-To: <45ED1996.7050008@archonet.com> References: <1172596221.393824.41130@j27g2000cwj.googlegroups.com> <45ED1996.7050008@archonet.com> Content-Type: text/plain; charset=ISO-8859-1 Date: Tue, 06 Mar 2007 08:53:27 +0100 Message-Id: <1173167607.4917.8.camel@hatman> Mime-Version: 1.0 X-Mailer: Evolution 2.6.2 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/184 X-Sequence-Number: 23589 Hi Richard, > > > > Here is my problem. With some heavy insert into a simple BD (one > > table, no indexes) i can't get better perf than 8000 inserts/sec. I'm > > testing it using a simple C software which use libpq and which use: > > - Insert prepared statement (to avoid too many request parsing on the > > server) > > - transaction of 100000 inserts > > Are each of the INSERTs in their own transaction? > No, as said above transactions are made of 100000 inserts... > If so, you'll be limited by the speed of the disk the WAL is running on. > > That means you have two main options: > 1. Have multiple connections inserting simultaneously. Yes, you're right. That what i have been testing and what provide the best performance ! I saw that postgresql frontend was using a lot of CPU and not both of them (i'm using a pentium D, dual core). To the opposit, the postmaster process use not much resources. Using several client, both CPU are used and i saw an increase of performance (about 18000 inserts/sec). So i think my bottle neck is more the CPU speed than the disk speed, what do you think ? I use 2 disks (raid 0) for the data and a single disk for pg_xlog. > 2. Batch your inserts together, from 10 to 10,000 per transaction. > Yes, that's what i'm doing. Thanks a lot for the advices ! regards, Joël