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 7F1E03A47F4 for ; Thu, 20 Jan 2005 15:26:48 +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 14278-08 for ; Thu, 20 Jan 2005 15:26:34 +0000 (GMT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id CAEDA3A47CA for ; Thu, 20 Jan 2005 15:26:37 +0000 (GMT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 989173596C; Thu, 20 Jan 2005 07:26:37 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 97022356BD; Thu, 20 Jan 2005 07:26:37 -0800 (PST) Date: Thu, 20 Jan 2005 07:26:37 -0800 (PST) From: Stephan Szabo To: Dan Langille Cc: pgsql-performance@postgresql.org Subject: Re: index scan of whole table, can't see why In-Reply-To: <41EF7C85.4180.D46F54D@localhost> Message-ID: <20050120072205.G38768@megazone.bigpanda.com> References: <41EEC527.22215.A7AAF84@localhost> <41EF7C85.4180.D46F54D@localhost> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.012 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/299 X-Sequence-Number: 9989 On Thu, 20 Jan 2005, Dan Langille wrote: > On 20 Jan 2005 at 6:14, Stephan Szabo wrote: > > > On Wed, 19 Jan 2005, 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 > > > > > > Any suggestions please? > > > > As a question, what does it do if enable_hashjoin is false? I'm wondering > > if it'll pick a nested loop for that step for the element/ports join and > > what it estimates the cost to be. > > With enable_hashjoin = false, no speed improvement. Execution plan > at http://rafb.net/paste/results/qtSFVM72.html Honestly I expected it to be slower (which it was), but I figured it's worth seeing what alternate plans it'll generate (specifically to see how it cost a nested loop on that join to compare to the fast plan). Unfortunately, it generated a merge join, so I think it might require both enable_hashjoin=false and enable_mergejoin=false to get it which is likely to be even slower in practice but still may be useful to see.