Is there a maximum expected mindistance? select min(distance(f.the_geom,g.the_geom)) from features f, grid g where st_dwithin(f,g,[maxmindistance]) group by ao.gid
P. On Tue, Jan 27, 2009 at 3:56 PM, Sky <shlyon+post...@gmail.com> wrote: > Hello all, I'm new to postgis and I'm hoping someone might help advise me! > > I have a 4 million point grid of lat lon pairs that have an associated > the_geom. I have a 2,000 point feature set with an associated > the_geom. I'd like to find the nearest feature to each grid point. I > wrote the statement: select min(distance(f.the_geom,g.the_geom)) from > features f, grid g group by ao.gid to obtain my desired result set. > The only problem I had is that this query took 9949764 ms (approx 2.5 > hours). Granted it's a large dataset, but I'd like to believe that > this calculation can be done more quickly. Any tips?? > > Thanks, > Sky > _______________________________________________ > postgis-users mailing list > postgis-users@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users > _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users