I will admit up front that I’m not awesome at SQL queries, so it’s entirely possible that I’m just missing something. I’m trying to use the Chart Builder to build a widget that will display rough utilization over time, out of a theoretical maximum. We have 20 threads of a process available for usage. If someone uses, say, 5 of the 20 available threads at 100% for a minute, then that’s 25% utilization for that minute. I’ve been able to make this work with this query:
SELECT (sum(duration)/1200)*100 as 'Estimated Usage' FROM Transaction TIMESERIES 1 minute EXTRAPOLATE
The place where I’m hitting my head against the wall is that this only works with
TIMESERIES 1 as long as the widget is capable of displaying 1-minute increments. as soon as I expand the timerange far enough, the number of 1-minute slices exceeds the maximum displayable, and the increment changes to something coarser, 20 minutes or so, and the math breaks.
My question is, is there a way of inserting the size of the timeslice into the query so that the math will work regardless of the time range? For instance, instead of:
(1200 comes from 60 (for minutes)*(20 threads))
Could I do something functionally equivalent to:
and then remove
TIMESERIES 1 altogether?
I realize that there’s probably an angle I’m just not thinking of, so I appreciate any guidance. Thanks!