X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 45431D1C4D5 for ; Fri, 1 Aug 2003 12:16:11 +0000 (GMT) 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 38911-03 for ; Fri, 1 Aug 2003 09:15:06 -0300 (ADT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id 3399DD1C4BF for ; Fri, 1 Aug 2003 09:16:09 -0300 (ADT) Received: from [10.1.2.130] (helo=dba2) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19iYpQ-0004bY-00 for ; Fri, 01 Aug 2003 08:16:12 -0400 Received: by dba2 (Postfix, from userid 1019) id B7519CEC9; Fri, 1 Aug 2003 08:16:12 -0400 (EDT) Date: Fri, 1 Aug 2003 08:16:12 -0400 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Odd explain estimate Message-ID: <20030801121612.GD18200@libertyrms.info> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <20030731195145.GD55392@nasby.net> <20030731205921.GF16230@libertyrms.info> <20030731225959.GH55392@nasby.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030731225959.GH55392@nasby.net> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/2 X-Sequence-Number: 2819 On Thu, Jul 31, 2003 at 05:59:59PM -0500, Jim C. Nasby wrote: > > Well, if I don't do this it wants to seqscan a table that occupies 350k > pages, instead of pulling a couple thousand rows. I started running it > with the seqscan and it's already taken way longer than it does if I > disable seqscan. That was indeed the question. If it uses a seqscan when it ought not to do, then there's something wrong with the statistics, or you haven't vacuum analysed correctly, or your table needs vacuum full (is it really 350k pages, or is that mostly dead space?), &c. -- all the usual bad-seqscan candidates. enable_seqscan=off is probably not a good strategy for any moderately complicated query. If the planner were perfect, of course, you'd never need it at all. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110