
Problem: Over the last month or so, we have noticed our SQL Server backend for Jira has been using more and more CPU on a weekly basis (as seen on the above screenshot). This is causing slowness experienced by the end user. We have never experienced this before and we have been a customer for roughly 3 to 4 years.
I had a look into the queries being fired, one query that stood out is the the one below:
select "AO_319474_MESSAGE"."CLAIMANT", "AO_319474_MESSAGE"."CLAIMANT_TIME", "AO_319474_MESSAGE"."CLAIM_COUNT", "AO_319474_MESSAGE"."CONTENT_TYPE", "AO_319474_MESSAGE"."CREATED_TIME", "AO_319474_MESSAGE"."EXPIRY_TIME", "AO_319474_MESSAGE"."ID", "AO_319474_MESSAGE"."MSG_DATA",
"AO_319474_MESSAGE"."MSG_ID", "AO_319474_MESSAGE"."MSG_LENGTH", "AO_319474_MESSAGE"."PRIORITY", "AO_319474_MESSAGE"."QUEUE_ID", "AO_319474_MESSAGE"."VERSION"
from "dbo"."AO_319474_MESSAGE" "AO_319474_MESSAGE"
where "AO_319474_MESSAGE"."QUEUE_ID" = @P0 and ("AO_319474_MESSAGE"."CLAIMANT" is null or "AO_319474_MESSAGE"."CLAIMANT" is not null and ("AO_319474_MESSAGE"."CLAIMANT_TIME" is null or "AO_319474_MESSAGE"."CLAIMANT_TIME" < @P1))
order by "AO_319474_MESSAGE"."PRIORITY" desc, "AO_319474_MESSAGE"."CREATED_TIME" asc, "AO_319474_MESSAGE"."ID" asc offset @P2 rows fetch next @P3 rows only
Any ideas as to why the CPU usage is increasing on a weekly basis for the past month? The query above is doing clustered index scans, would it be helpful for us to add an index that would cause the above query to do index seeks instead?