X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 21816D8CC4 for ; Tue, 13 Sep 2005 00:39:19 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18819-01 for ; Tue, 13 Sep 2005 03:39:17 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.203]) by svr1.postgresql.org (Postfix) with ESMTP id D0FA0D8CAF for ; Tue, 13 Sep 2005 00:39:15 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id i22so1581184wra for ; Mon, 12 Sep 2005 20:39:15 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=qrIMWRRyTBuD8tiTMXokI66WgxAvTr+sQwa+3aZjTQ3dGFw2SflcKUBK7x9VdLWlWOupbZVXICj2ezgOgm8qy6cBL5AR1hTgav8sBgf2cLdWfGngCFxkmjHF5JVAXBUqbI0yYcNrsjD5QgPVFHHXTOceuPmcQrsDW3RVLD97Nnw= Received: by 10.54.38.42 with SMTP id l42mr201669wrl; Mon, 12 Sep 2005 20:39:14 -0700 (PDT) Received: by 10.54.120.18 with HTTP; Mon, 12 Sep 2005 20:39:14 -0700 (PDT) Message-ID: <59d991c40509122039773cac17@mail.gmail.com> Date: Mon, 12 Sep 2005 23:39:14 -0400 From: Christopher Petrilli Reply-To: petrilli@gmail.com To: blblack@gmail.com Subject: Re: Performance considerations for very heavy INSERT traffic Cc: pgsql-performance@postgresql.org In-Reply-To: <84621a6050912140464c380c3@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <84621a6050912140464c380c3@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.135 required=5 tests=[AWL=0.111, RCVD_BY_IP=0.024] X-Spam-Level: X-Archive-Number: 200509/153 X-Sequence-Number: 14461 On 9/12/05, Brandon Black wrote: >=20 > I'm in the process of developing an application which uses PostgreSQL fo= r > data storage. Our database traffic is very atypical, and as a result it = has > been rather challenging to figure out how to best tune PostgreSQL on what > development hardware we have, as well as to figure out exactly what we > should be evaluating and eventually buying for production hardware. A few suggestions... 1) Switch to COPY if you can, it's anywhere from 10-100x faster than INSERT, but it does not necessarily fit your idea of updating multiple tables. In that case, try and enlarge the transaction's scope and do multiple INSERTs in the same transaction. Perhaps batching once per second, or 5 seconds, and returning the aggregate result ot the clients. 2) Tune ext3. The default configuration wrecks high-write situations. Look into data=3Dwriteback for mounting, turning off atime (I hope you've done this already) updates, and also modifying the scheduler to the elevator model. This is poorly documented in Linux (like just about everything), but it's crtical. 3) Use 8.1 and strongly look at Bizgres. The data partitioning is critical. 4) Make sure you are not touching more data than you need, and don't have any extraneous indexes. Use the planner to make sure every index is used, as it substantially increases the write load. I've worked on a few similar applications, and this is a hard thing in any database, even Oracle. Chris=20 --=20 | Christopher Petrilli | petrilli@gmail.com