Professional Documents
Culture Documents
04 - Plan Cache and Index Advice S4-4
04 - Plan Cache and Index Advice S4-4
04 - Plan Cache and Index Advice S4-4
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Db2 Optimization and Execution Feedback
SQE
Plan Cache Visual
Explain
SQE
Plan Cache
Snapshots
SQL request
SQL
Query
Performance
Optimization
Monitor
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Discovery Methodologies
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
The Process
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache – Show Statements
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache – Show Longest Runs
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache – Show Longest Runs
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache – Column filtering
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache – Column filtering
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache Properties
In addition to retaining all of the SQE access plans, the SQL plan
cache provides valuable insights into performance.
• The properties can and will change over time.
• Most properties are reported at the system/server level even though
access plans are subdivided by SYSBAS and IASP.
• The attributes described here are available as of IBM i 7.1
Properties are divided into three main types
• Summary and Usage – Information about plan usage, query usage,
and current conditions for the plan cache and queries
• Configuration – Properties that can be adjusted by the user
• Activity Thresholds – Represents the ‘high water mark’ of several key
indicators
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Accessing the Plan Cache Properties
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Plan Cache Properties Db2 for i
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache – Summary and Usage
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache – Summary and Usage
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache – Summary and Usage
• Job Scoped
– Queries that reference files or indexes in the QTEMP or SESSION
schemas
– (The third value reflects the Total Number since IPL)
• Current Total Size of Temporary Run Time Objects …
– Includes hash tables, sorted lists, buffers, etc. Some are cached for
reuse.
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache – Configuration
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache – Activity Thresholds
– Reflects IPL and can also be reset which resets all of the recorded
threshold values
– Each threshold shows both the maximum value and the timestamp of
when that maximum was reached
• Each row shows the highest value and the time at which it was
reached
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Plan Cache Properties – Best Practices Db2 for i
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache – Event Monitors
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache – Event Monitors
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
SQL Plan Cache – Event Monitors Db2 for i
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
SQL Plan Cache Snapshots Db2 for i
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache Snapshots
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache Snapshots
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Filters …
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache Snapshots
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache Snapshots
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache Snapshots
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache Snapshots
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache Snapshots
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache Snapshots
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Plan Cache Snapshots
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Index Advisor – System wide
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Index Advisor – System wide
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Index Advisor – System wide
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Index Advisor – System wide
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Index Advisor – System wide
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Index Advisor – System wide
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Index Advisor – System wide
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Index Advisor – Additional Options
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Creating Indexes
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Creating Indexes
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Creating Indexes – Columns
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Creating Indexes – Expression Builder
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Creating Indexes
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Creating Indexes
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Creating Indexes
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Index Builds
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Visual Explain
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Visual Explain
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Visual Explain – Explain while Running
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Details for Job (i.e. Connection)
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Details for Job (i.e. Connection)
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
SQL Details for Job (i.e. Connection)
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
Graphical Tools – Access Client Solutions
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation
Db2 for i
IBM Systems Lab Services – January 2019 Copyright 2019 IBM Corporation