X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1426256371 for ; Fri, 25 Feb 2005 00:49:01 +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 48189-08 for ; Fri, 25 Feb 2005 00:48:57 +0000 (GMT) Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) by svr1.postgresql.org (Postfix) with ESMTP id C198C52A54 for ; Fri, 25 Feb 2005 00:48:56 +0000 (GMT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id j1P0nBK08307; Thu, 24 Feb 2005 19:49:11 -0500 (EST) From: Bruce Momjian Message-Id: <200502250049.j1P0nBK08307@candle.pha.pa.us> Subject: Re: PostgreSQL ignores my indexes In-Reply-To: <20050223142526.GA9072@phlogiston.dyndns.org> To: Andrew Sullivan Date: Thu, 24 Feb 2005 19:49:11 -0500 (EST) Cc: pgsql-sql@postgresql.org X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/320 X-Sequence-Number: 20430 Andrew Sullivan wrote: > This is probably better on -performance, and is certainly a FAQ. > But. . . > > On Wed, Feb 23, 2005 at 03:01:52PM +0100, Thomas Braad Toft wrote: > > > > Table device contains 5285 rows, tmeevent contains 834912 rows. > ^^^^ ^^^^^^ > > > -> Seq Scan on tmeevent (cost=0.00..23606.12 rows=834912 width=138) > > (actual time=0.04..2193.97 rows=834912 loops=1) > ^^^^^^ > > > -> Seq Scan on device (cost=0.00..564.85 rows=5285 width=29) (actual > > time=0.04..25.07 rows=5285 loops=1) > ^^^^ > > > Why isn't the planner using my indexes? I tried making them as both rtree > > Because there's no advantage to using an index when you are fetching > 100% of both tables. This is the most efficient plan. Of course, > it's an open question whether you want to get 100% of both tables. > But that's what you're doing, and using the index would be more > expoensive than this. Right. The FAQ addresses this issue. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073