Displaying the execution plan

When you execute an SPL routine, it is already optimized. You can display the query plan for each SQL statement contained in the SPL routine

To display the query plan, execute the SET EXPLAIN ON statement prior to one of the following SQL statements that always tries to optimize the SPL routine:
  • CREATE PROCEDURE
  • UPDATE STATISTICS FOR PROCEDURE

    For example, use the following statements to display the query plan for an SPL routine:

    SET EXPLAIN ON; 
    UPDATE STATISTICS FOR PROCEDURE procname;