Ask HN: What's the best strategy for geospatial/chronological combined sort?
The scenario: you have a database of objects, each with a set of coordinates and a timestamp. You have a custom function f(d,t) that takes distance (d) from a specified origin and age (t) of the object and returns some kind of ranking for that specific origin and time. How could you set up a database index to make this kind of multi-dimensional sort efficient? In other words: how could one implement a "closest/most recent" sort that takes ALL database objects into account (i.e. no "limit by one factor and sort the other" solutions) but doesn't require processing the entire database every time?
I find it interesting that location-based services are in vogue and yet there seems to be no easy way to perform this kind of sort. Someone even asked about it on StackOverflow recently (not me):
http://stackoverflow.com/questions/6003943/find-most-recent-closest-posts-limit-20
Does anyone have any recommendations for a database system that could efficiently perform this sort? I have a feeling that I'm simply missing something obvious.
0 comments
[ 3.5 ms ] story [ 10.2 ms ] threadNo comments yet.