Re: index on points - Mailing list pgsql-general

From Tom Lane
Subject Re: index on points
Date
Msg-id 19545.971195784@sss.pgh.pa.us
Whole thread Raw
In response to Re: index on points  (Jeff Hoffmann <jeff@propertykey.com>)
List pgsql-general
Jeff Hoffmann <jeff@propertykey.com> writes:
> Tom Lane wrote:
>> There is already support for r-tree indexes, but as far as I know the
>> '@' operator is not connected up to indexes.

> i'm just throwing this out without testing it, but i think something
> like this might work:  coerce both the point and polygon into boxes (i
> think box(polygon) gives you the bounding box, at least) and use the
> overlap (&&) operator, which works fine with r-tree indexes on two
> boxes, then use the contained operator (@) on what you get from that.

Right, that's pretty much exactly what index support for @ would do for
you under-the-hood.  I wouldn't expect the index to give you an answer
finer-grained than bounding boxes, so you'd still need to run @ itself
on the candidates found by the indexable query.

Jeff has a good point that doing the transformation by hand might be
an acceptable answer for the time being.  You can hack a lot of queries
in the time it will take to teach the system to do that same
transformation ...

            regards, tom lane

pgsql-general by date:

Previous
From: "Efrain Caro"
Date:
Subject: Re: Delphi PostgreSQL Forum
Next
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] My new job