Improve reverse geocode query #5

Merged
merged 1 commit into from Nov 5, 2012

Projects

None yet

2 participants

@ivebeenlinuxed
Collaborator

After a few days running, it seems that the MySQL query used for latlng to postcode needed some revision work.

Before this commit the logs shows that most of the MySQL time was spent ordering the results and doing the maths.

This fix adds a "WHERE" clause, denoting an approximate 20 mile range to "short list" the geolocation. By doing this the application is only searching a limited number of postcodes in depth, rather than performing mathematics and ordering on the entire table.

See the improvements (home PC, hense the slow file_get_contents on HTTP request) here: http://twitpic.com/bajqto/full

This fix speeds up requests from approximately 10 seconds to 0.3 seconds.

@pezholio pezholio merged commit 732e115 into pezholio:master Nov 5, 2012
@pezholio
Owner
pezholio commented Nov 5, 2012

Thanks Will, that's awesome! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment