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 332B13A1D6B for ; Thu, 20 Jan 2005 11:54:27 +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 84266-10 for ; Thu, 20 Jan 2005 11:54:17 +0000 (GMT) Received: from bast.unixathome.org (bast.unixathome.org [66.11.174.150]) by svr1.postgresql.org (Postfix) with ESMTP id CBA863A468E for ; Thu, 20 Jan 2005 11:54:18 +0000 (GMT) Received: from wocker (wocker.unixathome.org [192.168.0.99]) by bast.unixathome.org (Postfix) with ESMTP id 42BA43D37; Thu, 20 Jan 2005 06:54:17 -0500 (EST) From: "Dan Langille" To: "=?ISO-8859-1?Q?Ragnar_Hafsta=F0?=" Date: Thu, 20 Jan 2005 06:56:20 -0500 MIME-Version: 1.0 Subject: Re: index scan of whole table, can't see why Cc: pgsql-performance@postgresql.org Message-ID: <41EF5614.28069.CB0CC42@localhost> In-reply-to: <1106213669.22416.17.camel@localhost.localdomain> References: <41EEC527.22215.A7AAF84@localhost> X-mailer: Pegasus Mail for Windows (4.21c) Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: Quoted-printable Content-description: Mail message body 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/263 X-Sequence-Number: 9953 On 20 Jan 2005 at 9:34, Ragnar Hafsta=F0 wrote: > 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 ? I tried sort_mem =3D 4096 and then 16384. This did not make a difference. See http://rafb.net/paste/results/AVDqEm55.html Thank you. -- Dan Langille : http://www.langille.org/ BSDCan - The Technical BSD Conference - http://www.bsdcan.org/