0% found this document useful (0 votes)
236 views6 pages

DB2 Explain Training

The document discusses creating a PLAN_TABLE to store the execution plan for a SELECT statement on the NLD1DBO.T_NLTR_TRD table, including running EXPLAIN PLAN to populate the PLAN_TABLE with the access plan and validating the results by selecting from the PLAN_TABLE.

Uploaded by

Sreenivas Rao
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
236 views6 pages

DB2 Explain Training

The document discusses creating a PLAN_TABLE to store the execution plan for a SELECT statement on the NLD1DBO.T_NLTR_TRD table, including running EXPLAIN PLAN to populate the PLAN_TABLE with the access plan and validating the results by selecting from the PLAN_TABLE.

Uploaded by

Sreenivas Rao
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 6

(1) Create a PLAN_TABLE in the default database.

Ensure that your userID owns the


object it creates , making it the SCHEMA . Here is the complete DDL .
(2) Browse the newly created Plan_Table . It should be empty.

(3) Select a Table with data. The table T_NLTR_TRD is selected whose creator is
NLD1DBO . This table has following indexes defined on it .
NLTRCU00
NLTRNN01
NLTRNN02

NLTRCU00 has following columns in it .


TRD_SYMB
TRD_DT
ACCT_NBR
ORD_NBR
ORIG_ID

NLTRNN01 has following columns in it .


TRD_STAT

NLTRNN02 has following columns


DAYOLD_IND
(3) Create a SPUFI member for running dynamic EXPLAIN PLAN
EXPLAIN PLAN SET QUERYNO =1
FOR
SELECT * FROM NLD1DBO.T_NLTR_TRD
WHERE TRD_SYMB = ? AND
TRD_DT> ? AND
ACCT_NBR = ? ;

This is a EXPLAIN PLAN with Page Range predicate . This means that any column after
the Page Predicate should not be matched in the search for the data for this SQL to
execute.

(4) To validate the PLAN table browse through the newly populated value in it . Or
run this SPUFI to test it .

SELECT ACCESSTYPE , MATCHCOLS, ACCESSNAME FROM


A367123.PLAN_TABLE
WHERE QUERYNO=1 ;

The result is :
---------+---------+---------+---------+---------+---------+
ACCESSTYPE MATCHCOLS ACCESSNAME
---------+---------+---------+---------+---------+---------+
I 2 NLTRCU00
DSNE610I NUMBER OF ROWS DISPLAYED IS 1

You might also like