Received: from www.propertykey.com (propertykey.com [206.196.37.193]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f3GEItu05756 for ; Mon, 16 Apr 2001 10:18:55 -0400 (EDT) (envelope-from jeff@propertykey.com) Received: from propertykey.com (gotojail.propertykey.com [206.196.37.197]) by www.propertykey.com (8.9.3/8.9.3) with ESMTP id JAA19065; Mon, 16 Apr 2001 09:18:41 -0500 Message-ID: <3ADAFF38.E7147C8D@propertykey.com> Date: Mon, 16 Apr 2001 09:18:32 -0500 From: Jeff Hoffmann Organization: PropertyKey.com X-Mailer: Mozilla 4.75 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: Julian Scarfe CC: pgsql-sql@postgresql.org Subject: Re: RTREE on points References: <9bbtqv$688$1@news.tht.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200104/248 X-Sequence-Number: 2598 Julian Scarfe wrote: > > explain select * from nodes where box(node,node) @ '((1,1),(3,3))'::box; > NOTICE: QUERY PLAN: > Seq Scan on nodes (cost=0.00..1.10 rows=1 width=28) > this should work, assuming you have enough points to make a difference (in the optimizer's mind, at least). the optimizer still doesn't do a great job of knowing when it's best to use an index, although, in your sample, there's no way it would ever be cheaper to use an index. there's simply not enough data there. you can test to see if an index can be used by a query by shutting off the sequential scans (set enable_seqscan=off) and retrying the query. essentially, this forces it to use an index scan if at all possible. -- Jeff Hoffmann PropertyKey.com