Plan Guides archives - SQL Server with Mr. Denny

SQL Server with Mr. Denny:

Plan Guides

Jan 22 2009   3:00PM GMT

Viewing SQL Server Plan Guides



Posted by: mrdenny
SQL Server 2005, SQL Server 2008, sys.plan_guides, Plan Guides, Code Snippet

So you’ve saved a plan guide into your SQL server, and you want to look at the plan.  You can Query the sys.plan_guides catalog view and see the data exactly as you entered it, which works fine if you just have a hint in there.  But if you have a full XML query plan that isn’t going to do you a lot of good since SSMS isn’t going to want to show you the all the XML as it is probably longer than it wants to display.

This little query should help you with that.  You may need adjust it slightly to account for extra spaces in your plan guide, I tried to account for double spaces, but if you have more than two spaces anywhere in the top part you’ll need to tweak it.

Continued »