The only improvement I can see is not to apply a function to your column, because that makes the query unsargable (unable to use indexes). Instead leave the column as it is and calculate the correct cutoff.
SELECT q_name, count(*)
FROM myTable
WHERE [status] = 2
--AND DATEDIFF(mi, create_stamp, getdate()) > 1
-- Adjust the logic to meet your requirements, because this is slightly different to what you had
AND create_stamp < DATEADD(minute, -1, getdate())
GROUP BY q_name;
Note, while dateadd
does accept abbreviations for the unit to add, its much clearer to type it in full.
(status, q_name) INCLUDE (create_stamp)
or(status, create_stamp) INCLUDE (q_name)
depending on the density statistics ofq_name