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 E4A10D1C4DB for ; Thu, 31 Jul 2003 20:59:23 +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 80446-05 for ; Thu, 31 Jul 2003 17:58:17 -0300 (ADT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id E47F1D1C4BD for ; Thu, 31 Jul 2003 17:59:21 -0300 (ADT) Received: from [10.1.2.130] (helo=dba2) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19iKW9-00014Z-00 for ; Thu, 31 Jul 2003 16:59:21 -0400 Received: by dba2 (Postfix, from userid 1019) id 4B40ECEC9; Thu, 31 Jul 2003 16:59:21 -0400 (EDT) Date: Thu, 31 Jul 2003 16:59:21 -0400 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Odd explain estimate Message-ID: <20030731205921.GF16230@libertyrms.info> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <20030731195145.GD55392@nasby.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030731195145.GD55392@nasby.net> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/514 X-Sequence-Number: 2807 On Thu, Jul 31, 2003 at 02:51:45PM -0500, Jim C. Nasby wrote: > Why is pgsql estimating a cost of 100000000 for retire_today in this > query? I analyzed it, and there's nothing very odd about it, other than > it's a temp table. > > BTW, I had to set enable_seqscan=false to get this, otherwise it wants That's why. When you do that, it just automatically adds 100000000 to the cost of a seqscan. It can't really disable it, because there might be no other way to pull the result. If you really needed to set enable_seqscan=false (did you really? Are you sure that's not the cheapest way?), you might want to investigate expainding the statistics on the indexed column, increasing the correlation through clustering, and other such tricks. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110