educative.io

Educative

Why Media table has Latitude and Longitude, can't we use same from FeedItem table

Why Media table has Latitude and Longitude, can’t we use same from FeedItem table

Hi @Abdul3!

In the first query, we are searching for the places nearest to our location. But this query is inefficient as we can have a large number of places in the mentioned radius. We can mention the grids to limit the places further. The second query looks in the grids and returns the places nearest to our location in those grids.

This is not yelp or uber problem. Why are you searching for grid here. Facebook feed has latitude and longitude and media is associated to feed. Feed and media should have same location. Hence, asked why we need to have latitude and longitude for media in facebook.

@Abdul3, apologies for this. I might have misunderstood your question there. You are right. We do not need these columns in our Media table.