﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / T-SQL (SS2K8)  / High CPU usage (Because of bad execution plan) / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 12:25:08 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: High CPU usage (Because of bad execution plan)</title><link>http://www.sqlservercentral.com/Forums/Topic1369257-392-1.aspx</link><description>If it is a paramater sniffing option and you are using SQL2008 you can use the Query Hint OPTION(RECOMPILE) on the offending SELECT statement, which should solve the issue and give you and indication if this is the case.As the previous poster suggested try to avoid using WITH RECOMPILE on functions an SP's as that can cause more problems.</description><pubDate>Mon, 08 Oct 2012 03:17:19 GMT</pubDate><dc:creator>Jason-299789</dc:creator></item><item><title>RE: High CPU usage (Because of bad execution plan)</title><link>http://www.sqlservercentral.com/Forums/Topic1369257-392-1.aspx</link><description>As stated above, it could be parameter sniffing. If you have identified what procedure runs that cause the sniffing capture that parameter in particular that causes this. Now, don't put the recompile option for the procedure as a solution as that will be costly in the long run. Use other methods like declaring a local variable and copying the procedure parameter to it.Also, if you would like some experts to look into your code to make it more elegant, please post the DDL and execution plans.ThanksChandan</description><pubDate>Mon, 08 Oct 2012 01:31:28 GMT</pubDate><dc:creator>chandan_jha18</dc:creator></item><item><title>RE: High CPU usage (Because of bad execution plan)</title><link>http://www.sqlservercentral.com/Forums/Topic1369257-392-1.aspx</link><description>If the SP uses parameters in the WHERE or JOIN clauses, you might investigate the possibility that parameter sniffing caused a bad plan to be cached. There are many excellent articles on parameter sniffing available on SSC, just do a search of articles and blogs.</description><pubDate>Fri, 05 Oct 2012 12:36:02 GMT</pubDate><dc:creator>Roland Alexander STL</dc:creator></item><item><title>High CPU usage (Because of bad execution plan)</title><link>http://www.sqlservercentral.com/Forums/Topic1369257-392-1.aspx</link><description>Hi everyone,We have a server, which has SQL SERVER 2008 R2,periodically we face with high CPU usage(100%) on this server.We found out that the high CPU usage is related to a bad execution plan for a stored procedure.After recompiling the Stored Procedure,The CPU usage come back to normal.Is there any way to prevent cashing the bad execution plan ?Thanks</description><pubDate>Fri, 05 Oct 2012 12:28:49 GMT</pubDate><dc:creator>Aspet Golestanian Namagerdi</dc:creator></item></channel></rss>