[postgis-users] PostGIS spatial query performance
Jan Hartmann
jhart at frw.uva.nl
Fri Aug 9 06:48:53 PDT 2002
-----Original Message-----
From: postgis-users-admin at postgis.refractions.net
[mailto:postgis-users-admin at postgis.refractions.net]On Behalf Of Dave
Blasby
Sent: Thursday, August 08, 2002 10:50 PM
To: postgis-users at postgis.refractions.net
Dave Blasby wrote:
> select park.* from park,roads
> where
> expand(box3d(park.the_geom),2) && box3d(roads.the_geom)
> and distance(park.the_geom, roads.the_geom) <=2;
>
> The base problem is that you are still asking the database to do something
like:
> For each feature in park
> see if there are any features in roads that are < 2km away
> And thats going to take a long time.
Dave, is this really so? It thought it worked as a shortcut operator like &&
in C:
for each feature in park
see if it overlaps with any feature in roads
and only if so, compute the distance
As far as I know, lots of optimizing can be done within PostgreSQL by
arranging selects, subselects and explicit joins. This would be especially
important for the Java Topology Suite.
Jan
More information about the postgis-users
mailing list