Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 17404634EC9 for ; Mon, 23 Feb 2009 11:10:00 -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 33787-08 for ; Mon, 23 Feb 2009 11:09:54 -0400 (AST) 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 1B2F0634E7C for ; Mon, 23 Feb 2009 11:09:53 -0400 (AST) 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 n1NF9n3L003563; Mon, 23 Feb 2009 10:09:50 -0500 (EST) To: Robert Haas cc: kouber@saparev.com, pgsql-performance@postgresql.org Subject: Re: LIMIT confuses the planner In-reply-to: <603c8f070902230653v346f5b5cm6aeceedce7903f5@mail.gmail.com> References: <49A295F0.5010405@saparev.com> <603c8f070902230653v346f5b5cm6aeceedce7903f5@mail.gmail.com> Comments: In-reply-to Robert Haas message dated "Mon, 23 Feb 2009 09:53:41 -0500" Date: Mon, 23 Feb 2009 10:09:49 -0500 Message-ID: <3562.1235401789@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: 200902/265 X-Sequence-Number: 32846 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. regards, tom lane