5

In my stored procedure, it will do a lot of insert/update queries, and call a few nested stored procedures.

I want to disable the execution plan, bypassing the above mentioned queries, then switch it on to start profiling those queries I am interested in.

for example:

...switch off execution plan

INSERT INTO FOO ...
UPDATE FOO...
EXEC usp_FOO

...switch on execution plan here then I can start getting the performance stat

SELECT * FROM FOO

In SQL Server Management Studio, we have "Include Actual Execution Plan" for performance trace/debug, but if there are more than 100 queries, the execution plan output will exceed and stop working. So I believe there should be some switch like 'SET EXECUTION PLAN OFF' something like that

2
  • By "disable the execution plan" do you mean that you wish to cause SQL Server to not use its pre-cached execution plan? How will you be collecting performance stats?
    – sfuqua
    Sep 7, 2011 at 0:39
  • sorry, I did not clearly explain my question. Please read the last part of my question, I just added detail info.
    – unruledboy
    Sep 7, 2011 at 0:56

2 Answers 2

1

I recommend reading Capture execution plans with SQL Server 2005 Profiler. Using profiler, you can generate execution plans for every single query that is run in your stored procedure without worrying about the output limitations of SQL Server Management Studio.

0

You can use query hints to force a 'RECOMPILE' (ignore the cached plan) for all CRUD and MERGE -- def & samples here: http://msdn.microsoft.com/en-us/library/ms181714.aspx

1
  • hi, I think what you mentioned is to advice sql server how to use the execution plan. But what I want is to manipulate the "Include Actual Execution Plan" in the management studio for showing the execution plan information.
    – unruledboy
    Sep 7, 2011 at 5:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.