X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 75BC83A5E82 for ; Thu, 13 Jan 2005 02:07:30 +0000 (GMT) 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 13486-06 for ; Thu, 13 Jan 2005 02:07:16 +0000 (GMT) Received: from mail.coretech.co.nz (coretech.co.nz [202.36.204.41]) by svr1.postgresql.org (Postfix) with ESMTP id 8AE983A5E6F for ; Thu, 13 Jan 2005 02:07:17 +0000 (GMT) Received: (qmail 8333 invoked from network); 13 Jan 2005 02:07:17 -0000 Received: from 218-101-12-250.paradise.net.nz (HELO ?192.168.1.11?) (218.101.12.250) by 0 with SMTP; 13 Jan 2005 02:07:17 -0000 Message-ID: <41E5D8C0.5080304@coretech.co.nz> Date: Thu, 13 Jan 2005 15:11:12 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20041016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-1?Q?Ragnar_Hafsta=F0?= Cc: pgsql-performance@postgresql.org Subject: Re: Postgres Optimizer is not smart enough? References: <20050112222506.32084.qmail@web13124.mail.yahoo.com> <41E5AF3F.2080100@coretech.co.nz> <1105577416.5220.50.camel@localhost.localdomain> In-Reply-To: <1105577416.5220.50.camel@localhost.localdomain> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200501/159 X-Sequence-Number: 9849 Ragnar Hafstaš wrote: > > > > it is not rational to have random_page_cost < 1. > I agree, in theory one should never *need* to set it < 1. However in cases when the optimizers understanding of things is a little off, compensation may be required to achieve better plans (e.g. encouraging index scans on data with funny distributions or collelations). > if you see improvement with such a setting, it is as likely that > something else is wrong, such as higher statistic targets needed, > or a much too low effective_cache setting. > Altho this is good advice, it is not always sufficient. For instance I have my effective_cache_size=20000. Now the machine has 512Mb ram and right now cache+buf+free is about 100M, and shared_buffers=2000. So in fact I probably have it a bit high :-). Increasing stats target will either make the situation better or worse - a better sample of data is obtained for analysis, but this is not *guaranteed* to lead to a faster execution plan, even if in general/usually it does. cheers Mark