I have several calls to the FilteredSummaries method. By "several" I mean upwards of 46,200 distinct calls. Each individual call (which is usually about 8h worth of pretty normal data) seems pretty fast. However, when they are placed in a loop, it takes a long, long time. I'd like to know what the most efficient parameters are for collecting results from the FilteredSummaries call.
Here's some background:
The calls I am making utilize an expression that evaluates a tag against several other tags (e.g. limits & masks). The "other" tags all have values in PI at a frequency of 1 minute. The "source" tag is variable in frequency. (I'm not sure if this plays a role, but better to explain it than leave it out.) As alluded to earlier, the time range is typically 8-12h. The goal of the expression is to count the number of MINUTES the value exceeded a limit. So based on that, I have the following call to FilteredSummaries:
IDictionary<AFSummaryTypes, AFValues> values = myElement.Attributes["My Source Tag"].Data.FilteredSummaries( timeRange, new AFTimeSpan(timeRange.Span), myFilterExpression, AFSummaryTypes.Count, AFCalculationBasis.TimeWeighted, AFSampleType.Interval, new AFTimeSpan(minutes:1), AFTimestampCalculation.Auto);
The 2 parts I imagine need tweaking are the 2 parameter (summaryDuration) and the 2nd-last parameter (sampleInterval). However, even when reading the document, I'm not sure how best to tweak these values to get the best performance while not sacrificing the clarity of the result (which is technically the # of seconds the value was outside the limits).
Alternatively, maybe someone can tell me if FilteredSummaries can be run in bulk like other data calls can? Maybe the answer is to perform many calculations at once rather than all of them individually. This would be akin to getting a bunch of snapshot values at once rather than tag-by-tag. Is this possible with FilteredSummaries?