Skip to content
Snippets Groups Projects
Commit d55fe527 authored by Matthew Landauer's avatar Matthew Landauer
Browse files

Added help text to explain that an index is required to take advantage of the...

Added help text to explain that an index is required to take advantage of the bounding box optimisation
parent cf0bd9bf
No related branches found
No related tags found
No related merge requests found
......@@ -527,6 +527,15 @@ Calling `obj.coordinates` directly returns the internal representation of the co
For consistency with the rest of Geocoder, always use the `to_coordinates` method instead.
Optimisation of Distance Queries
--------------------------------
In MySQL and Postgres the finding of objects near a given point is speeded up by using a bounding box to limit the number of points over which a full distance calculation needs to be done.
To take advantage of this optimisation you need to add a composite index on latitude and longitude. In your Rails migration:
add_index :table, [:latitude, :longitude]
Distance Queries in SQLite
--------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment