I'm querying each SQL Server DB CPU usage (based on query from here -- Get CPU utilization by database (Query 29) (CPU Usage by Database)) every 60 seconds and storing this information in dedicated table for that purpose with columns:
id, dbname, date, usage
Now I'm interested in querying this DB for databases which are using most CPU usage but only if DB usage X subsequent reads where higher than Y (so I'm not interested in DB which had CPU usage spikes).
time1 - 0 time2 - 35 time3 - 0 time4 - 1
time1 - 9 time2 - 8 time3 - 7 time4 - 11
In this example I'm not interested in DB1 because it had only one CPU spike and it's average CPU usage is low. DB2 on the other hand has average higher CPU usage in subsequent reads and this type of DB I'm trying to find in my usage table.
EDIT: My mistake. Version 2012