Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 9F68563476E for ; Tue, 10 Mar 2009 21:09:11 -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 96382-07-2 for ; Tue, 10 Mar 2009 21:09:02 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 6212D634C2C for ; Tue, 10 Mar 2009 21:09:08 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id n2B094bd017385; Tue, 10 Mar 2009 20:09:04 -0400 (EDT) To: "Kevin Grittner" cc: "Steve McLellan" , pgsql-performance@postgresql.org Subject: Re: Query performance over a large proportion of data In-reply-to: <49B69E1E.EE98.0025.0@wicourts.gov> References: <1ca6422a7addad0207f758f54300dd0b.squirrel@semichrome.net> <49B69E1E.EE98.0025.0@wicourts.gov> Comments: In-reply-to "Kevin Grittner" message dated "Tue, 10 Mar 2009 17:06:38 -0500" Date: Tue, 10 Mar 2009 20:09:04 -0400 Message-ID: <17384.1236730144@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200903/88 X-Sequence-Number: 33010 "Kevin Grittner" writes: > 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. It might be worth pointing out here that all that matters are the relative values of the various xxx_cost parameters. If your DB is mostly or entirely cached, you probably want to lower the estimated cost of I/O relative to CPU work. You can do that *either* by dropping the seq_/random_page_costs, *or* by raising the cpu_xxx_costs (there are more than two of those BTW). Doing both, as Kevin's comments might be read to suggest, is not useful ... and in particular I bet that having seq_page_cost actually less than cpu_tuple_cost would lead to some pretty wacko decision-making by the planner. See http://www.postgresql.org/docs/8.3/static/runtime-config-query.html for some more info about what you're twiddling here. regards, tom lane