Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UOULi-00053R-1c for pgsql-performance@arkaria.postgresql.org; Sat, 06 Apr 2013 14:44:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UOULh-0005jP-HF for pgsql-performance@arkaria.postgresql.org; Sat, 06 Apr 2013 14:44:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UOULg-0005iS-5H for pgsql-performance@postgresql.org; Sat, 06 Apr 2013 14:44:08 +0000 Received: from relaygateway01.edpnet.net ([212.71.1.210]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UOULb-0000ys-3D for pgsql-performance@postgresql.org; Sat, 06 Apr 2013 14:44:07 +0000 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApMBAFE0YFHV25ey/2dsb2JhbAANRMRdgReDEwEBAQMBOEABBQsLDgoJFg8JAwIBAgFFBg0BBQIBAYgKq16KEokRjxsHg0ADqwg X-IronPort-AV: E=Sophos;i="4.87,420,1363129200"; d="scan'208";a="155059784" Received: from 213.219.151.178.adsl.dyn.edpnet.net (HELO [192.168.0.10]) ([213.219.151.178]) by relaygateway01.edpnet.net with ESMTP; 06 Apr 2013 16:43:48 +0200 Message-ID: <516034A6.3030703@ulb.ac.be> Date: Sat, 06 Apr 2013 16:43:50 +0200 From: Julien Cigar User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130405 Thunderbird/17.0.5 MIME-Version: 1.0 To: Kevin Grittner CC: "pgsql-performance@postgresql.org" Subject: Re: slow joins? References: <515FFEB1.4040606@ulb.ac.be> <1365258149.7784.YahooMailNeo@web162906.mail.bf1.yahoo.com> In-Reply-To: <1365258149.7784.YahooMailNeo@web162906.mail.bf1.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -0.8 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 04/06/2013 16:22, Kevin Grittner wrote: > Julien Cigar wrote: > >> try to increase cpu_tuple_cost to 0.1 > I agree that's on the right track, but possibly an overly blunt > tool for the job. The following settings are likely to need > adjustment, IMO: > > effective_cache_size: People often set this to somewhere in the > range of 50% to 75% of the RAM on the machine. This setting does > not allocate RAM, but tells the planner how likely it is to find > things in cache for, say, repeated index access. A higher setting > makes the random access involved in index scans seem like less of a > problem. I agree that the very first thing to check is effective_cache_size > random_page_cost: You seem to have a very high cache hit ratio, > between shared_buffers and the OS cache. To model this you should > decrease random_page_cost to something just above seq_page_cost or > equal to it. To reflect the relatively low cost of reading a page > from the OS cache (compared to actually reading from disk) you > might want to reduce both of these below 1. 0.1 is a not-uncommon > setting for instances with the active portion of the database > well-cached. I would first raise cpu_tuple_cost rather than touch random_page_cost. Raising cpu_tuple_cost is a more "fine-grained method" for discouraging seqscans than random_page_cost is. > cpu_tuple_cost: I always raise this; I think our default is just > too low to accurately model the cost of reading a row, compared to > the cost factors used for other things. In combination with the > above changes I've never had to go beyond 0.03 to get a good plan. > I've pushed it to 0.05 to see if that put me near a tipping point > for a bad plan, and saw no ill effects. I've never tried higher > than 0.05, so I can't speak to that. Yep, default cpu_tuple_cost is just too low .. > In any event, your current cost settings aren't accurately modeling > actual costs in your environment for your workload. You need to > adjust them. > > One of the estimates was off, so increasing the statistics sample > size might help, but I suspect that you need to make adjustments > like the above in any event. > -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance