-
Type:
Improvement
-
Resolution: Fixed
-
Priority:
Major
-
Component/s: SolarQuery
-
None
The /mostRecent SolarQuery API is used to find the most recently posted datum. Generally this is used to quickly show what data is available. The query does not require a date range, however, so SolarNetwork must search across all time for the most recent records, and with the datum database tables being highly-partitioned, this can lead to extra work to find the results. Also for long-running nodes with many sources, this can result is returning a large amount of data, much of which might be old an not relevant for the "most recent" spirit of the query.
I propose adding an implicit start date into the /mostRecent query parameters, if one is not otherwise provided, based on a configurable time period like "90 days". When a /mostRecent query does not explicitly provide a startDate or localStartDate, then SolarNetwork will add one to the query based on this time period, offset backwards from the current time.