My main usage in the DB is to store and use geo-spatial data. When I move (and therefore have new coordinates) I would like the DB to “know” that it should move its focal point with me. Since I’m using an embedded system with limited resources (RAM) I need the DB to “know” which data to fetch from its local FS (file system) so when I perform a query (e.g. $geoWithin) the most relevant data will be accessable in minimum time. I need to configure the local database server to know to have the relevant data in RAM and update itself in accordance with my geo-position changes (my queries will reflect my position).
Is that possible?
if so, please guide me to the solution.
I think what you’re describing (a server knowing its position in real time and adjust its cache accordingly) is beyond the functionality provided by databases. A database should be able to retrieve your queries as quickly as possible. Knowing its location is tangential to its purpose.
Having said that, unless you have a very strict location-based SLA, the database should be able to cope. It may need to warm up its cache for the first query using the new location, but subsequent queries should be faster.
One possible solution off the top of my head is to have a regular cron job querying the database using the current location, so the cache will stay warm using that particular location (at least for the time in-between the cron job running). How often the cron job runs will depend on how often you envision location change will take place. There’s also a balancing act required to ensure that the cron job is small enough to affect the cache, but not too large that it interferes with the database operation.