[postgis-users] help optimize distance calculation
pramsey at opengeo.org
Tue Jan 27 16:16:30 PST 2009
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
On Tue, Jan 27, 2009 at 3:56 PM, Sky <shlyon+postgis at 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??
> postgis-users mailing list
> postgis-users at postgis.refractions.net
More information about the postgis-users