2

What is the most efficient way to get just the latest event of each time series to display the current values of all stored time series?

Martin
  • 818
  • 9
  • 20

1 Answers1

0

TSI does support Aggregation as described here https://learn.microsoft.com/en-in/rest/api/time-series-insights/dataaccess(preview)/query/execute#aggregateseries.

I did try to put an example on how to use that here: https://github.com/zainuvk/AzureIoTSamples/blob/master/AzureTSI_WebAPI/AzureTSI_WebAPI/Controllers/ValuesController.cs

Hope this helps.

Zainu
  • 120
  • 1
  • 7
  • 1
    Thank you. Your code shows a very general solution to query time series. I already have a similar working query which is not very fast if a have a lot of different timeseries because I need to ask each time series for the last events by querying the past few hours order by descending timestamp and take the latest event. What I want is the latest event of each time series and I was wondering if there is a more efficient way. – Martin Nov 22 '19 at 10:18
  • 1
    What I imaging is a query which gets the MAX(timestamp) of each time series and the corresponding values. Is there a performant way to get this, without looping over the values? – Martin Nov 22 '19 at 10:28