Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 2DD216335AB for ; Tue, 10 Mar 2009 19:06:51 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 70853-06 for ; Tue, 10 Mar 2009 19:06:43 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by mail.postgresql.org (Postfix) with ESMTP id 27D3763320F for ; Tue, 10 Mar 2009 19:06:48 -0300 (ADT) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Tue, 10 Mar 2009 17:06:47 -0500 Message-Id: <49B69E1E.EE98.0025.0@wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 7.0.3 Date: Tue, 10 Mar 2009 17:06:38 -0500 From: "Kevin Grittner" To: "Steve McLellan" , Subject: Re: Query performance over a large proportion of data References: <1ca6422a7addad0207f758f54300dd0b.squirrel@semichrome.net> In-Reply-To: <1ca6422a7addad0207f758f54300dd0b.squirrel@semichrome.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200903/86 X-Sequence-Number: 33008 >>> "Steve McLellan" wrote: > The server itself is a dual-core 3.7GHz Xeon Dell (each core > reporting 2 logical CPUs) running an amd64 build of FreeBSD 6.2, and > postgres 8.3.5 built from source. It's got 400GB storage in RAID-5 > (on 5 disks). It has 8GB of physical RAM. I'm able to use about 6GB > of that for my own purposes; the server doesn't do much else but > replicates a very low-usage mysql database. > shared_buffers=1200MB You might want to play with this -- that's not a bad starting point, but your best performance with your load could be on either side of that value. > work_mem = 100MB Probably kinda high, especially if you expect a lot of connections. This much memory can be concurrently used, possibly more than once, by each active connection. > fsync = off Don't use this setting unless you can afford to lose your entire database cluster. We use it for initial (repeatable) loads, but not much else. > enable_seqscan = off Not a good idea; some queries will optimize better with seqscans. You can probably get the behavior you want using other adjustments. > effective_cache_size = 2000MB From what you said above, I'd bump this up to 5GB or more. You probably need to reduce random_page_cost. If your caching is complete enough, you might want to set it equal to seq_page_cost (never set it lower that seq_page_cost!) and possibly reduce both of these to 0.1. Some people have had good luck with boosting cpu_tuple_cost and cpu_index_tuple_cost. (I've seen 0.5 for both recommended.) I've never had to do that, but if the earlier suggestions don't get good plans, you might try that. I hope that helps. -Kevin