Displaying the SQL plan for cached statements

You can view the plan for a cached statement using these functions:

show_cached_plan (int SSQLID)
show_plan (int option, int SSQLID)

For a statement that is not performing well, you can change the plans by altering the optimizer settings or specifying an abstract plan.

When you specify the first int variable in the existing show_plan argument as “-1”, show_plan treats the second parameter as a SSQLID.

NoteIt is possible for a single entry in the statement cache to be associated with multiple, and possibly different, SQL plans. show_plan displays only one of them.