Re: RTREE on points

From: Jeff Hoffmann <jeff(at)propertykey(dot)com>
To: Julian Scarfe <julian(at)avbrief(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: RTREE on points
Date: 2001-04-16 14:18:32
Message-ID: 3ADAFF38.E7147C8D@propertykey.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Eisentraut 2001-04-16 14:42:30 Re: Using Random Sequence as Key
Previous Message Peter Eisentraut 2001-04-16 14:03:54 Re: Now for the VARDATA, VARSIZE, and VARHDRSZ stuff