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 DC2608B9E42 for ; Wed, 23 Feb 2005 14:25:47 +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 11147-08 for ; Wed, 23 Feb 2005 14:25:25 +0000 (GMT) Received: from smtp103.rog.mail.re2.yahoo.com (smtp103.rog.mail.re2.yahoo.com [206.190.36.81]) by svr1.postgresql.org (Postfix) with SMTP id 2CFF08B9E18 for ; Wed, 23 Feb 2005 14:25:27 +0000 (GMT) Received: from unknown (HELO phlogiston.dydns.org) (a.sullivan@rogers.com@216.75.167.195 with login) by smtp103.rog.mail.re2.yahoo.com with SMTP; 23 Feb 2005 14:25:27 -0000 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 408183F9E; Wed, 23 Feb 2005 09:25:26 -0500 (EST) Date: Wed, 23 Feb 2005 09:25:26 -0500 From: Andrew Sullivan To: pgsql-sql@postgresql.org Subject: Re: PostgreSQL ignores my indexes Message-ID: <20050223142526.GA9072@phlogiston.dyndns.org> References: <53775.193.162.192.11.1109167312.squirrel@webmail.tuffmail.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53775.193.162.192.11.1109167312.squirrel@webmail.tuffmail.net> User-Agent: Mutt/1.5.6+20040907i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/270 X-Sequence-Number: 20380 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. A -- Andrew Sullivan | ajs@crankycanuck.ca Information security isn't a technological problem. It's an economics problem. --Bruce Schneier