SQL-Server-First-Responder-Kit icon indicating copy to clipboard operation
SQL-Server-First-Responder-Kit copied to clipboard

sp_Blitz Could Detect MisGuided Plans

Open LitKnd opened this issue 12 years ago • 1 comments

This is a database level check. It only works in SQL Server 2008+. (Plan guides apparently exist in 2005 but they were even suckier then.)

Low pri, this feature doesn't get used much, it just might be easy to add and could be a quick win in a rare situation.

If the following query returns > 0, you have a plan guide in the database that's hosed-- and it could be making queries silently fail.

SELECT 
    COUNT(*)
FROM sys.plan_guides
CROSS APPLY fn_validate_plan_guide(plan_guide_id);
GO

For the documentation. To get details on the error, a user can run:

SELECT 
    plan_guide_id, msgnum, severity, state, message, 
    name, create_date, is_disabled, query_text, scope_type_desc, scope_batch, parameters, hints
FROM sys.plan_guides
CROSS APPLY fn_validate_plan_guide(plan_guide_id);
GO

LitKnd avatar Jun 18 '14 01:06 LitKnd

Added in v40, but not tested because yolo.

BrentOzar avatar Mar 01 '15 18:03 BrentOzar