X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CA9993A4463 for ; Thu, 20 Jan 2005 09:33:19 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61328-06 for ; Thu, 20 Jan 2005 09:33:14 +0000 (GMT) Received: from quasar.skima.is (quasar.skima.is [212.30.200.205]) by svr1.postgresql.org (Postfix) with ESMTP id 14F003A444B for ; Thu, 20 Jan 2005 09:33:15 +0000 (GMT) Received: from gnari ([157.157.193.37] [157.157.193.37]) by quasar.skima.is with ESMTP; Thu, 20 Jan 2005 09:33:15 Z Subject: Re: index scan of whole table, can't see why From: Ragnar =?ISO-8859-1?Q?Hafsta=F0?= To: Dan Langille Cc: pgsql-performance@postgresql.org In-Reply-To: <41EEC527.22215.A7AAF84@localhost> References: <41EEC527.22215.A7AAF84@localhost> Content-Type: text/plain Date: Thu, 20 Jan 2005 09:34:29 +0000 Message-Id: <1106213669.22416.17.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200501/259 X-Sequence-Number: 9949 On Wed, 2005-01-19 at 20:37 -0500, Dan Langille wrote: > Hi folks, > > Running on 7.4.2, recently vacuum analysed the three tables in > question. > > The query plan in question changes dramatically when a WHERE clause > changes from ports.broken to ports.deprecated. I don't see why. > Well, I do see why: a sequential scan of a 130,000 rows. The query > goes from 13ms to 1100ms because the of this. The full plans are at > http://rafb.net/paste/results/v8ccvQ54.html > > I have tried some tuning by: > > set effective_cache_size to 4000, was 1000 > set random_page_cost to 1, was 4 > > The resulting plan changes, but no speed improvment, are at > http://rafb.net/paste/results/rV8khJ18.html > this just confirms that an indexscan is not always better than a tablescan. by setting random_page_cost to 1, you deceiving the planner into thinking that the indexscan is almost as effective as a tablescan. > Any suggestions please? did you try to increase sort_mem ? gnari