[postgis-users] Why does this take almost 3 hours?

Ethan Alpert ealpert at digitalglobe.com
Wed Sep 7 14:19:10 PDT 2005



I always use && first if my previous posts on this didn't have it then
that was a typo. If I didn't use && I doubt the query would have ever
returned.

-e

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Markus Schaber
Sent: Wednesday, September 07, 2005 5:24 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Why does this take almost 3 hours?


Hi, Ethan,

Ethan Alpert wrote:

> select catalogid,cii_region from new_snaps a, nga_reg b where
> distance(a.the_geom,b.the_geom) <= 0 and catalogid = ?

What about the following query:


select catalogid,cii_region from new_snaps a, nga_reg b where
(a.the_geom && b.the_geom) and distance(a.the_geom,b.the_geom) <= 0 and
catalogid = ?

This should use a quick bbox scan even before the distance calculation,
and an utilize one or even both geometric indices on the the_geom
columns.

HTH,
Markus
_______________________________________________
postgis-users mailing list postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list