Use the show_plan function to view the plan for a cached statement.
show_plan(spid, batch_id, context_id, statement_number)
spid – process ID for any user connection.
batch_id – unique number for a batch.
context_id – unique number for every procedure (or trigger).
statement_number – number of the current statement within a batch.
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.