X-Original-To: pgsql-performance@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 2939C475F00 for ; Tue, 29 Apr 2003 10:18:51 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 6D86B475ADE for ; Tue, 29 Apr 2003 10:18:15 -0400 (EDT) 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 h3TEIJU6026350; Tue, 29 Apr 2003 10:18:19 -0400 (EDT) To: Rod Taylor Cc: Rob Messer , Postgresql Performance Subject: Re: Optimizer not using index when it should In-reply-to: <1051621449.76105.9.camel@jester> References: <20030429090301.13152.qmail@web41213.mail.yahoo.com> <1051621449.76105.9.camel@jester> Comments: In-reply-to Rod Taylor message dated "29 Apr 2003 09:04:09 -0400" Date: Tue, 29 Apr 2003 10:18:19 -0400 Message-ID: <26349.1051625899@sss.pgh.pa.us> From: Tom Lane X-Spam-Status: No, hits=-31.0 required=5.0 tests=BAYES_00,EMAIL_ATTRIBUTION,IN_REP_TO,NO_DNS_FOR_FROM, QUOTED_EMAIL_TEXT,REFERENCES,REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/244 X-Sequence-Number: 1750 Rod Taylor writes: >> What can I do to fix this -- is there something I am missing about >> setting statistics or some configuration variable I can change? Any >> insights would be greatly appreciated. Thank you, > You might try adjusting the random_page_cost down to something more > appropriate for your hardware and situation. Also, is the table physically ordered by dsid? If so, is that condition likely to persist? You may be looking at a test-condition artifact here --- a poor estimate for an ordered table may not mean much when you get to realistic database states. I assume you've done an ANALYZE of course --- what does the pg_stats row for column dsid contain? regards, tom lane