ruby on rails - Is it necessary to add index to latitude and longitude fields -


i using rails , geocoder gem postgres database. therefore have add latitude , longitude fields database. speaking isnt better add indexing fields faster querying?

if end querying database records using latitude , longitude, you'll benefit adding index. indexes used not exact matching queries, comparison queries, such select * table_name latitude between 30 , 40 , longitude > 50. depending on queries , number of records, postgres query planner choose optimal way find matching records (either sequential scan, or index scan).


Comments

Popular posts from this blog

ios - Memory not freeing up after popping viewcontroller using ARC -

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -