Tag Info

New answers tagged


You have pretty much suggested the answer to your own question already, which is that you don't have any indexes. I would suggest that you convert your lat/lon columns to a geography (point) data type, add a spatial index, and rewrite the query to use ST_DWithin, which uses a spatial index, if available, and works with geometries or geographies. ALTER ...


I really think that joining on 1 = 1 is not a good idea... Try making your select statement smaller by using ST_DWithin(geom1, geom2, 300) , which is definitely faster than ST_Distance_Sphere() Build indexes! Can you share the data? A portion at least. UPDATE: I guess it would be useful to narrow down the join with distance condition before the join ...

Top 50 recent answers are included