We might have an solution. It's called Datos Rapidos.
You can store the pre-calculated time-range based results in a private or public CDN as JSON or binary files and fetch them, when needed, in a convenient way using our SDKs.
The fundamental idea is that you calculate the data only once and reuse it multiple times, directly within your application.
With Datos Rapidos you can map a set of query parameters to a canonical URL and fetch the pre-calculated result from the CDN instantly. There is no need to maintain terabytes or even petabytes of data in the database and wait for slow queries, if the query results do not change over time.
You need to show to the business a number of unique users for a specific date range.
Mobile users are splitted into iOS users and Android users.
The sample REST API URL to your would be:
https://api.yourdomain.com/v1/unique-users.json?platform=ios&from=2024-01-01&to=2024-01-31
Instead of querying your large MongoDB or SQL database, you can pre-calculate the results and store it in a JSON file, like:
{
"count": 123456
}
, using the URL path pattern like this:
https://api.yourcdn.com/unique-users/platform--ios_from--2024-01-01_to--2024-01-31.json
The URL pattern can be modified in the SDK or used by default as follows:
Rules for file naming:
The reuse phase is pretty straightforward:
This way you can cache all the data that is unmodifiable over time and significantly speed up your API for large amount of requests.
For terabytes or petabytes of data, there is no better way to cache results than to have it available as list of URLs.