X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 47020D1BA9F for ; Thu, 21 Aug 2003 19:05:38 -0300 (ADT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 66185-06 for ; Thu, 21 Aug 2003 19:05:08 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 1FACAD1BA0D for ; Thu, 21 Aug 2003 19:05:06 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h7LM575H029275; Thu, 21 Aug 2003 18:05:07 -0400 (EDT) To: Stephan Szabo Cc: Chris Miles , pgsql-admin@postgresql.org Subject: Re: This table won't use INDEX until I DUMP/RESTORE it ? In-reply-to: <20030821101658.I51705-100000@megazone.bigpanda.com> References: <20030821101658.I51705-100000@megazone.bigpanda.com> Comments: In-reply-to Stephan Szabo message dated "Thu, 21 Aug 2003 10:26:06 -0700" Date: Thu, 21 Aug 2003 18:05:07 -0400 Message-ID: <29274.1061503507@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/259 X-Sequence-Number: 9980 Stephan Szabo writes: > That was more to get its idea for the cost of the index scan. > As a short term thing, if you havent played with random_page_cost, > I'd suggest lowering it from the default 4 to say 3 or 2 and see > what plan it gives you. Given the closeness of the two cost estimates, random_page_cost shouldn't need to be moved much at all to flip the plan choice to indexscan for this particular query. You might want to move it more so that the ratio of the estimates approximates reality, but I advise caution on that, or at least caution on using this example as the test case. There's a fairly large misestimate of the number of returned rows in there too, and so if you use this case you'll be conflating the effects of that misestimate with the effects of random_page_cost being wrong for your environment. regards, tom lane