[postgis-users] a long time calculate distance between point and polygon

Nicklas Avén nicklas.aven at jordogskog.no
Wed Dec 5 13:44:38 PST 2012


Hallo

You should use ST_DWithin instead with gist index on your
gometry/geography column:

select * from pozos p,suelos s where
ST_DWithin(p.the_geom,s.the_geom,1000)


HTH

Nicklas



On Wed, 2012-12-05 at 16:32 -0500, Francisco Salas wrote:
> Hi, 
> 
> I have test in two database one with SRID 2085 an other 4326 use this
> sql  
> 
> pozos : 2339 rows 
> 
> suelos:1526 rows
> 
> for 2085 :   
> 
> select * from pozos p,suelos s where
> st_distance(p.the_geom,s.the_geom)
> 
> <=1000  
> 
> time of result : 3 minutes aprox    
> 
>  
> 
> for 4326 :   
> 
> select * from pozos p,suelos s where
> st_distance(p.the_geom,s.the_geom,true)
> 
> <=1000  
> 
> time of result : not determined   
> 
> Why happen this problem?  
> 
> How I can optimize this?  
> 
> I am using PostGis 1.5.2
> 
>  
> 
> Regards,
> 
>  
> 
> Francisco Salas 
> 
>  
> 
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users




More information about the postgis-users mailing list