Im porting an application from mysql to postgres, and have several tables with 500k+ rows in each of geo points (lat, lon). In mysql i used a bounding box query with haversine to select rows within a given distance of a center point. i understand i can use either postgis's st_dwithin or the earthdistance module (or i could probably port my mysql query over too). Just wondering if anyone has a recommendation on which method would be best performance wise with these large data sets.

1 Answer 1


Use st_dwithin. It will use the spatial index and do the job very fast if it is only points. 500 000 points is not that much.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.