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 5CB5DD893E for ; Thu, 1 Sep 2005 20:09:44 -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 50912-06 for ; Thu, 1 Sep 2005 23:09:38 +0000 (GMT) Received: from smtpauth01.mail.atl.earthlink.net (smtpauth01.mail.atl.earthlink.net [209.86.89.61]) by svr1.postgresql.org (Postfix) with ESMTP id F019CD8921 for ; Thu, 1 Sep 2005 20:09:35 -0300 (ADT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=SaDRLVdv9mYqlvk2ZXYT3ZMaskU8HnqjH+6qcpYdIdJi4ZAVnBGubIRkYWN/lNDR; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [24.41.3.216] (helo=RJP-01.earthlink.net) by smtpauth01.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1EAyBd-00054U-Kl; Thu, 01 Sep 2005 19:09:37 -0400 Message-Id: <6.2.3.4.0.20050901184427.05ecb4a8@pop.earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.3.4 Date: Thu, 01 Sep 2005 19:09:32 -0400 To: Matthew Sackman , pgsql-performance@postgresql.org From: Ron Subject: Re: Massive performance issues In-Reply-To: <20050901222239.GG7131@pongo.lshift.net> References: <20050901174231.GE23970@pongo.lshift.net> <20050901200930.GA23339@uio.no> <20050901210626.GC7131@pongo.lshift.net> <6.2.3.4.0.20050901173454.021c5730@pop.earthlink.net> <20050901222239.GG7131@pongo.lshift.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bc396aa5b1d465d3407bf79d57c1a94566350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 24.41.3.216 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.375 required=5 tests=[AWL=0.001, DNS_FROM_RFC_ABUSE=0.374] X-Spam-Level: X-Archive-Number: 200509/37 X-Sequence-Number: 14345 At 06:22 PM 9/1/2005, Matthew Sackman wrote: >On Thu, Sep 01, 2005 at 06:05:43PM -0400, Ron wrote: > > > > Since I assume you are not going to run anything with the string > > "unstable" in its name in production (?!), why not try a decent > > production ready distro like SUSE 9.x and see how pg 8.0.3 runs on a > > OS more representative of what you are likely (or at least what is > > safe...) to run in production? > >Well, you see, as ever, it's a bit complicated. The company I'm doing >the development for has been subcontracted to do it and the contractor was >contracted by the actual "client". So there are two companies involved >in addition to the "client". Sadly, the "client" actually has dictated >things like "it will be deployed on FreeBSD and thou shall not argue". At least get them to promise they will use a release the BSD folks mark "stable"! >At this point in time, I actually have very little information about the >specification of the boxen that'll be running this application. This is >something I'm hoping to solve very soon. The worst part of it is that >I'm not going have direct (ssh) access to the box and all configuration >changes will most likely have to be relayed through techies at the >"client" so fine tuning this is going to be a veritable nightmare. IME, what you have actually just said is "It will not be possible to safely fine tune the DB unless or until I have direct access; and/or someone who does have direct access is correctly trained." Ick. > > >> > I need to get to the stage where I can run queries such as: > > >> > select street, locality_1, locality_2, city from address > > >> > where (city = 'Nottingham' or locality_2 = 'Nottingham' > > >> > or locality_1 = 'Nottingham') > > >> > and upper(substring(street from 1 for 1)) = 'A' > > >> > group by street, locality_1, locality_2, city > > >> > order by street > > >> > limit 20 offset 0 > > >> > > >> This might be a lot quicker than pulling all the records like in > > >your example > > >> queries... > > > > > >Yes, that certainly does seem to be the case - around 4 seconds. But I > > >need it to be 10 times faster (or thereabouts) otherwise I have big > > >problems! > > > > *beats drum* Get it in RAM, Get it in RAM, ... > >Ok, but I currently have 2 million rows. When this launches in a couple >of weeks, it'll launch with 5 million+ and then gain > a million a year. At my previously mentioned optimum of 85B per row, 2M rows is 170MB. 5M rows is 425MB. Assuming the gain of 1M rows per year, that's +85MB per year for this table. Up to 2GB DIMMs are currently standard, and 4GB DIMMs are just in the process of being introduced. Mainboards with anything from 4 to 16 DIMM slots are widely available. IOW, given the description you've provided this DB should _always_ fit in RAM. Size the production system such that the entire DB fits into RAM during ordinary operation with an extra 1GB of RAM initially tossed on as a safety measure and the client will be upgrading the HW because it's obsolete before they run out of room in RAM. >I think the upshot of this all is 4GB RAM as a minimum and judicious use >of normalization so as to avoid more expensive string comparisons and >reduce table size is my immediate plan (along with proper configuration >of pg). My suggestion is only slightly different. Reduce table size(s) and up the RAM to the point where the whole DB fits comfortably in RAM. You've got the rare opportunity to build a practical Memory Resident Database. It should run like a banshee when you're done. I'd love to see the benches on the final product. Ron Peacetree