When we receive data from a client, we receive a series of coordinates. Presently, at data submission time, we compute the distance from those points to the nearest country(s), however this places heavy strain on the database for computing multiple distances, as well as prevents the server from replying quickly to the client that the data was effectively received.
We need to store the data that we receive from the client as it is (ie store the point), and perform the country lookup during the aggregation stage, preferably by pulling all the country shapes into memory and doing the point distance queries 100% in memory.
When we receive data from a client, we receive a series of coordinates. Presently, at data submission time, we compute the distance from those points to the nearest country(s), however this places heavy strain on the database for computing multiple distances, as well as prevents the server from replying quickly to the client that the data was effectively received.
We need to store the data that we receive from the client as it is (ie store the point), and perform the country lookup during the aggregation stage, preferably by pulling all the country shapes into memory and doing the point distance queries 100% in memory.