Finding abstract plans

Use sp_find_qplan to search both the query text and the plan text to find plans that match a given pattern.

This example finds all plans where the query includes the string “from titles”:

sp_find_qplan "%from titles%"

This example searches for all abstract plans that perform a table scan:

sp_find_qplan "%t_scan%"

When a system administrator or database owner executes sp_find_qplan, the procedure examines and reports on plans owned by all users. When other users execute the procedure, sp_find_qplan searches and reports on only plans that they own.

To search just one abstract plan group, specify the group name. This example searches only the test_plans group, finding all plans that use a particular index:

sp_find_qplan "%i_scan title_id_ix%", test_plans

For each matching plan, sp_find_qplan prints the group ID, plan ID, query text, and abstract plan text.