The procedure below was extracted from a stored procedure that was found during a database Assessment.
It was causing CPU pressure on the client’s server.
Using the query store
Using it, you can review a list of the highest resource consuming queries and drill down further by selecting individual queries to view more details.
What was done
- Replace the table variables with temporary tables;
- Create a indexed view and replaced a subquery with it.
Tuning results vary. They vary based on the query’s complexity, how much tuning has gone into it already, etc.
But we rarely can’t make T-SQL perform faster.