Big One Time Use Queries
If you have arrived at this page as a result of running the Server Health report, congratulations you are on the first step to improving your server health.
What does this mean to my SQL Server
If you have many queries with cached plans that are taking up lots of space, and have only been used once, this is using up memory that could be used more efficiently.
How Do I Fix It
Use Parameterized Queries
The biggest win for cleaning up big one time use queries is to use Parameterized Queries. When a query is executed, there are 2 main parts to the query being run.
- Parsing the query. This can be skipped if there is already a matching query found that has been parsed. Parameterized queries help the already parsed queries to get reused again.
- Executing the query. The step of getting the data and returning the result set.
You can’t get around the second step, but the first step will be skipped if the query has already been parsed.