5 Essential Ways To Use Iseries Navigator - SQL Plan Cache: It'S Always On, and It'S Always There
5 Essential Ways To Use Iseries Navigator - SQL Plan Cache: It'S Always On, and It'S Always There
5 Essential Ways To Use Iseries Navigator - SQL Plan Cache: It'S Always On, and It'S Always There
Technology Reports
february 2007
SystemiNetwork.com
FIgure 1
SQL Plan Cache Statements window
FIgure 2
Query filter options
SystemiNetwork.com
february 2007
Technology Reports
then you can ignore these logical files by specifying a QAQQINI file with IGNORE_DERIVED_
INDEXES = *YES in the query environment.
To determine which query engine was used via the
database monitor data, interrogate column QQC16
where QQRID = 3014. The value of 'N' indicates
CQE is used, and column QVC43 will contain the
reason SQE was not used. The query in Figure 3
shows an example.
Technology Reports
february 2007
FIgure 3
Query to determine which query engine was used
SELECT x.qqjnumasJobNumber,
x.qqucntasQueryID,
x.qqi5asQueryInstance
y.qvc43as"ReasonforCQE",
x.qq1000asSQLText
FROM DBmonitortablename--x,
DBmonitortablename--y
WHERE
x.qqjfld=y.qqjfld
AND x.qqrid=1000
AND x.qqc21IN('SI','OP','IN','UP','DL')
AND x.qqucnt<>0
AND y.qqrid=3014
AND y.qqc16='N'
ORDERBY qqjnum,
qqucnt
qqi5;
FIgure 4
Total Cached Results Used column
function. A dialog appears to let you specify the second snapshot and thresholds
(Figure 6).
5. Keep Track of
the Information
FIgure 5
Snapshot of the plan cache data
FIgure 6
Compare function dialog
Mike Cain is a senior technical staff member within the IBM Systems and
Technology Group and team leader of the DB2 for i5/OS Center of Competency. Prior to
his current position, Mike worked as an IBM AS/400 systems engineer and IT consultant.
Mike is in Rochester, Minnesota, and can be reached at [email protected].
february 2007
Technology Reports
FIgure 7
To help automate the process of creating a snapshot before any normal IPL, use the power down
system (PWRDWNSYS) exit point QIBM_QWC_
PWRDWNSYS. If you register a program at this exit
point via the WRKREGINF command, i5/OS will call
the program prior to the power down operation. Your
exit point program can use the RUNSQLSTM command to call the stored procedure.
Another useful collection strategy is to systematically collect SQE Plan Cache information by creating
a snapshot on a regular basis at a consistent interval
for example, after the weekend batch process or every
Monday morning. Once the data is collected at regular
intervals, you can determine trends and spikes and
evaluate them. And if a query does go bad for some
reason, having a benchmark of a good run will be valuable in understanding what, if anything, changed in
the query environment.