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 5BB12D1B8F5 for ; Wed, 20 Aug 2003 20:03:45 -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 37710-09 for ; Wed, 20 Aug 2003 20:03:37 -0300 (ADT) Received: from megazone.bigpanda.com (45.mufb.snfc.sffca01r18.dsl.att.net [12.103.249.45]) by svr1.postgresql.org (Postfix) with ESMTP id E13E5D1B905 for ; Wed, 20 Aug 2003 20:03:30 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 6124CD67F; Wed, 20 Aug 2003 16:03:24 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 48AFC5C0D; Wed, 20 Aug 2003 16:03:24 -0700 (PDT) Date: Wed, 20 Aug 2003 16:03:24 -0700 (PDT) From: Stephan Szabo To: Chris Miles Cc: Subject: Re: This table won't use INDEX until I DUMP/RESTORE it ? In-Reply-To: <3F425458.2020802@psychofx.com> Message-ID: <20030820160024.X20088-100000@megazone.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/243 X-Sequence-Number: 9964 On Tue, 19 Aug 2003, Chris Miles wrote: > I have a DB that appears to perform badly. A test of one table > with one of the typical queries gives me a query plan indicating > a Seq Scan; > > DB=# EXPLAIN select pcref,pcseqnbr from catrecrel where > pcbsref='something' and (pccaref is null or pccaref='') and pcpar is > null order by pcseqnbr ; > NOTICE: QUERY PLAN: > > Sort (cost=38266.65..38266.65 rows=4 width=58) > -> Seq Scan on catrecrel (cost=0.00..38266.61 rows=4 width=58) What does it give if you set enable_seqscan=off; before the explain? And what does explain analyze give both with seqscan disabled and enabled? Also, what version are you running?