Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 2DDA3633134 for ; Mon, 23 Feb 2009 14:44:12 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 18974-03 for ; Mon, 23 Feb 2009 14:44:08 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ringonce.com (zalloo.com [62.213.196.40]) by mail.postgresql.org (Postfix) with ESMTP id BBB3A63313B for ; Mon, 23 Feb 2009 14:44:08 -0400 (AST) Received: from mail.securax.org (unknown [212.123.25.145]) by ringonce.com (Postfix) with ESMTPS id A1BD610C806C for ; Mon, 23 Feb 2009 19:44:05 +0100 (CET) Received: (qmail 15433 invoked by uid 2077); 23 Feb 2009 17:46:29 -0000 Received: from unknown (HELO rt.attractel.com) (89.253.129.130) by mail.securax.org with (DHE-RSA-AES256-SHA encrypted) SMTP; 23 Feb 2009 17:46:29 -0000 Received: (qmail 22674 invoked by uid 89); 23 Feb 2009 18:44:04 -0000 Received: by simscan 1.4.0 ppid: 22668, pid: 22671, t: 0.0549s scanners: clamav: 0.92.1 /m: Received: from unknown (HELO ?10.2.2.158?) (kouber@securax.org@10.2.2.158) by cocaine with ESMTPA; 23 Feb 2009 18:44:04 -0000 Message-ID: <49A2EE86.5070805@saparev.com> Date: Mon, 23 Feb 2009 20:44:22 +0200 From: Kouber Saparev Reply-To: kouber@saparev.com User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: LIMIT confuses the planner References: <49A295F0.5010405@saparev.com> <603c8f070902230653v346f5b5cm6aeceedce7903f5@mail.gmail.com> <3562.1235401789@sss.pgh.pa.us> In-Reply-To: <3562.1235401789@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 200902/269 X-Sequence-Number: 32850 Tom Lane wrote: > Robert Haas writes: >> If you left seq_page_cost (which isn't mentioned here) at the default >> value but reduced random_page_cost to 0.1, then you have >> random_page_cost < seq_page_cost. That's probably Bad. > > ... well, it's certainly going to push the planner to believe indexscans > are cheaper than sorts no matter what. > > The previously noted rowcount estimation problem might be a bigger issue > in this particular case, but I agree this is a Bad Idea. So I've set it wrong, I guess. :-) Now I put it to: seq_page_cost = 1 random_page_cost = 2 Regards, -- Kouber Saparev http://kouber.saparev.com