Download Performance Guide for IBM Informix Dynamic Server

Transcript
SQL Optimization
Figure 10-13 summarizes the information that the database server stores in
system catalog tables during the compilation process.
Procedure characteristics
sysprocedures
procname procid
get_sum 1
get_avg
2
SPL code
Query tree, dependency list
Pcode
sysprocbody
Figure 10-13
SPL Information
Stored in System
Catalog Tables
sysprocplan
procid data
1
Ny4yMkMx..
2
Ny4yMkMx..
procid data
1
create dba get_sum(order_a...
2
create dba get_avg(order_a...
Displaying the Execution Plan
When you execute an SPL routine, it is already optimized. To display the
query plan for each SQL statement contained in the SPL routine, 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;
Queries and the Query Optimizer 10-39