I am making a multi-restaurant appliances and everything is done but I think it'll not might not scale.
Problem
I have GEO Location (Latitude and Longitude) of user and Restuarant. I am listing all restaurants within 3 Kilometres. I have tested on small scale and it worked but I am worried, what would happen when there will be 100,000 Restuarant.
If User ask for nearby Restaurants then I will filter from 100,000 Restuarant. To filter I'll calculate distance between user GEO Location to all 100,000 restuarant.
I don't know if I'm thinking right or wrong? What would be the possibile solution?
Top comments (3)
This is something you want the PostGIS extension for. Store the location as a geographic point with latitude and longitude, and in your query first filter by a bounding box big enough to contain a circle of 3km radius around your user.
See gis.stackexchange.com/questions/83... for more.
Thank you, Dian Fay
I will check the PostGIS
Thanks for your response but still I have confusion
If user 1 comes from GEO => Lat: 1.6513 and Long 23.9876
If user 2 comes from GEO => Lat: 1.6514 and Long 23.9876
Will this request hit the database or use the cache?