SlideShare a Scribd company logo
1 of 7
Download to read offline
TECHNICAL WHITE PAPER




Using SQL Performance for DB2:
Diagnose RIDPool Failures
Introduction
These days, more and more Dynamic SQL is running on DB2 for z/OS and the proportion is increasing.
Those SQL Statements are coming from a variety of applications and platforms. One thing all Dynamic SQL
statements have in common is that before going into the DB2 Engine to be executed one of their stops is the
Dynamic Statement Cache (DSC).

The DSC is a storage pool in which DB2 saves prepared SQL statements access paths be shared among different
threads, plans, and packages. By sharing those statements, applications can avoid unnecessary preparation
processes and thus improve performance. After an SQL statement has been prepared the Statement Text and
its access path are automatically saved in the cache. Subsequent prepare requests for that same SQL statement
can avoid the costly preparation process by using the access path that’s already stored in the cache.

There are several ways to identify Dynamic SQL statements in APPTUNE for DB2. If it’s a long running
application, the “View current DB2 status by subsystem” menu shows running active threads. You can easily
check for the DISTSERV Plan from “SUMMARY OF ACTIVE THREADS” screen and then drill down to find more
details.

If the thread is already completed, the “Analyze current and historical SQL workloads” menu shows near-Term
History of threads.

Another alternative is the “Analyze dynamic statement cache statistics” menu which is the main focus area
of this section. It provides a general picture of dynamic statement cache performance at low cost with some
additional functions.


DETAILS...
In order for the DSC metrics to be available, DB2 IFCID 318 must be active in a trace. IFCID 318 can be easily
activated inside Apptune by using the DSC feature. You don’t need to keep it “active” all the time. In a heavy
loaded system, activating it only for a few minutes provides plenty of valuable information.

Identify a Tablespace Scan caused by a RID List failure, rather than its original access path.

A tablespace scan is easily identified in DB2 Plan Table by a value of “R” in the Access Type column if this is the
original access path. However, a more reasonable access path can also be converted into a tablespace scan at
runtime, when it’s much harder to find. Let’s check the following scenario.

IFCID 318 is activated for 14 seconds and data is collected for 13,672 SQL Calls as follows




If you look at the detail of the collection period using the “T” drill down option, the following section gives you a
good summary of the running SQL statements. If the number of “Tablespace Scans” and “Sorts Performed” are
greater than zero, it means there are SQL Statements that are not using indexes efficiently or perhaps there is
no valid Index at all.




                                                        1
The next step is to check the SQL statements in the DSC, sorted by GETPAGE. It’s always very easy in Apptune
to create an ordered list. Move your cursor on the Getpage column and press PF4 for ascending order or PF5
for descending. It’s likely that the statement with the highest average number of getpages is the one doing the
Tablespace Scan and/or Sort operation. As a cautionary note, the Tablespace Scan field not only shows the
access path itself, it also indicates when an SQL access path was changed into a Tablespace Scan after RID Pool
failures. Be sure to check for this possibility before taking any action steps.

See the example below. There is one SQL Statement whose Getpage count (1720) is significantly larger than the
rest.




Let’s check to see if there are any RIDPool failures.

When the SQL statement (above) with the highest Getpages count is EXPLAINed (using the Explain option (X))
there is no Tablespace Scan shown. However you will see Multi-Index access and List Prefecth, which means the
RIDPool will be used during execution




                                                        2
SELECT *

FROM         FEE_CD A, FEE_STD B, FEE_MSTR_RATE D

WHERE A.LDBID = ? AND A.LDBID = B.LDBID

AND A.APRVL_VALUE = ‘appr’ AND A.FLST_VALUE = ‘actv’

AND A.FECD_EFCTV_DATE <= ? AND A.FECD_HOST_TS =

    (SELECT MAX(C.FECD_HOST_TS)

    FROM         FEE_CD C WHERE C.LDBID = ?

        AND C.FECD_EFCTV_DATE <= ? AND C.CDN_IDFR = A.CDN_IDFR

    )

AND B.CDN_IDFR = A.CDN_IDFR_FECD_IS_D

AND B.CRUD_VALUE <> ‘D’ AND B.FES_EFCTV_DATE <= ?

AND B.CDN_IDFR = ? AND B.FES_HOST_TS =

    (SELECT MAX(FES_HOST_TS)

        FROM      FEE_STD

        WHERE CDN_IDFR = B.CDN_IDFR

            AND FES_EFCTV_DATE <= ?

        )

 AND D.LDBID = A.LDBID

 AND D.FEMR_IDFR = A.FEMR_IDFR AND D.FEMR_EFCTV_DATE <= ?

 AND D.APRVL_VALUE = ‘appr’ AND D.FEMR_HOST_TS =

        (SELECT MAX(FEMR_HOST_TS)

        FROM      FEE_MSTR_RATE

        WHERE LDBID = ? AND FEMR_IDFR = D.FEMR_IDFR

            AND FEMR_EFCTV_DATE <= ?

        )

 AND NOT EXISTS

        (SELECT 1

        FROM      FEE_PRFL_CD T4

        WHERE T4.LDBID = ?

            AND T4.CDN_IDFR_FPC = A.CDN_IDFR




                                                    3
AND T4.RIFS_IDFR = ? AND T4.FPC_HOST_TS =

              (SELECT MAX(FPC_HOST_TS)

              FROM   FEE_PRFL_CD

              WHERE LDBID = ? AND CDN_IDFR = T4.CDN_IDFR

              )

       )

 ORDER BY FECD_NAME

 FOR        READ ONLY



When we look at the details of the SQL Statement, we see that there are 210 RID List failures




                                                     4
As well as 210 Tablespace scan as follows.




This proves that the cause of those tablespace scans are are RIDPool failures rather than the original path,
and it would be very difficult to determine this without execution statistics at the Statement level. The next
steps should be to check the related RID Pool DSNPARM settings to determine whether changing these may
help, as well as evaluating the Statement itself to determine whether the dependence on the RID pool can be
reduced.




About the Author
                    IBM Champion Cuneyt Goksu is an independent DB2 specialist and IBM Gold Consultant
                    since 2009. His main activity is linked to DB2 for z/OS and LUW Installation, Migration,
                    Administration and Performance Tuning. He has presented papers at several
                    conferences, local events and writing articles for IT magazines. Cuneyt is currently a
                    member IDUG Board of Directors, he is the leader of Turkish DB2 Users Group and IBM
                    Authorized DB2 Training Partner. Cuneyt can be reached at cuneytgoksu@usa.net




                                                     5
Business Runs on I.T. I.T. Runs on BMC Software
Business runs better when IT runs at its best. Tens of thousands of IT organizations around the world -- from
small and mid-market businesses to the Global 100 -- rely on BMC Software (NASDAQ: BMC) to manage their
business services and applications across distributed, mainframe, virtual and cloud environments. BMC helps
customers cut costs, reduce risk and achieve business objectives with the broadest choice of IT management
solutions, including industry-leading Business Service Management and Cloud Management offerings. For the
four fiscal quarters ended September 30, 2012, BMC revenue was approximately $2.2 billion. www.bmc.com




BMC, BMC Software, and the BMC Software logo are the exclusive properties of BMC Software, Inc., are registered with the U.S. Patent and Trademark Office, and may be
registered or pending registration in other countries. All other BMC trademarks, service marks, and logos may be registered or pending registration in the U.S. or in other
countries. Linux is the registered trademark of Linus Torvalds. All other trademarks or registered trademarks are the property of their respective owners.
© 2012 BMC Software, Inc. All rights reserved. Origin date: 1/13
                                                                                                                                                                              *357593*

More Related Content

What's hot

DB2 for z/OS Real Storage Monitoring, Control and Planning
DB2 for z/OS Real Storage Monitoring, Control and PlanningDB2 for z/OS Real Storage Monitoring, Control and Planning
DB2 for z/OS Real Storage Monitoring, Control and PlanningJohn Campbell
 
Using Release(deallocate) and Painful Lessons to be learned on DB2 locking
Using Release(deallocate) and Painful Lessons to be learned on DB2 lockingUsing Release(deallocate) and Painful Lessons to be learned on DB2 locking
Using Release(deallocate) and Painful Lessons to be learned on DB2 lockingJohn Campbell
 
IDUG NA 2014 / 11 tips for DB2 11 for z/OS
IDUG NA 2014 / 11 tips for DB2 11 for z/OSIDUG NA 2014 / 11 tips for DB2 11 for z/OS
IDUG NA 2014 / 11 tips for DB2 11 for z/OSCuneyt Goksu
 
Hp vertica certification guide
Hp vertica certification guideHp vertica certification guide
Hp vertica certification guideneinamat
 
Consolidating older database servers onto Dell PowerEdge FX2 with FC830 serve...
Consolidating older database servers onto Dell PowerEdge FX2 with FC830 serve...Consolidating older database servers onto Dell PowerEdge FX2 with FC830 serve...
Consolidating older database servers onto Dell PowerEdge FX2 with FC830 serve...Principled Technologies
 

What's hot (6)

DB2 for z/OS Real Storage Monitoring, Control and Planning
DB2 for z/OS Real Storage Monitoring, Control and PlanningDB2 for z/OS Real Storage Monitoring, Control and Planning
DB2 for z/OS Real Storage Monitoring, Control and Planning
 
Using Release(deallocate) and Painful Lessons to be learned on DB2 locking
Using Release(deallocate) and Painful Lessons to be learned on DB2 lockingUsing Release(deallocate) and Painful Lessons to be learned on DB2 locking
Using Release(deallocate) and Painful Lessons to be learned on DB2 locking
 
IDUG NA 2014 / 11 tips for DB2 11 for z/OS
IDUG NA 2014 / 11 tips for DB2 11 for z/OSIDUG NA 2014 / 11 tips for DB2 11 for z/OS
IDUG NA 2014 / 11 tips for DB2 11 for z/OS
 
Hp vertica certification guide
Hp vertica certification guideHp vertica certification guide
Hp vertica certification guide
 
Consolidating older database servers onto Dell PowerEdge FX2 with FC830 serve...
Consolidating older database servers onto Dell PowerEdge FX2 with FC830 serve...Consolidating older database servers onto Dell PowerEdge FX2 with FC830 serve...
Consolidating older database servers onto Dell PowerEdge FX2 with FC830 serve...
 
DB2 and Codepages
DB2 and CodepagesDB2 and Codepages
DB2 and Codepages
 

Similar to SQL Performance for DB2: Diagnose RIDPool Failures Causing Tablespace Scans

Identify SQL Tuning Opportunities
Identify SQL Tuning OpportunitiesIdentify SQL Tuning Opportunities
Identify SQL Tuning OpportunitiesCuneyt Goksu
 
Gaining Insight into
Gaining Insight intoGaining Insight into
Gaining Insight intoCuneyt Goksu
 
Track 2 session 4 db2 for z os optimizer- what’s new in db2 11 and exploiti...
Track 2 session 4   db2 for z os optimizer- what’s new in db2 11 and exploiti...Track 2 session 4   db2 for z os optimizer- what’s new in db2 11 and exploiti...
Track 2 session 4 db2 for z os optimizer- what’s new in db2 11 and exploiti...IBMSystemzEvents
 
DB2 Real-Time Analytics Meeting Wayne, PA 2015 - IDAA & DB2 Tools Update
DB2 Real-Time Analytics Meeting Wayne, PA 2015 - IDAA & DB2 Tools UpdateDB2 Real-Time Analytics Meeting Wayne, PA 2015 - IDAA & DB2 Tools Update
DB2 Real-Time Analytics Meeting Wayne, PA 2015 - IDAA & DB2 Tools UpdateBaha Majid
 
xTech2006_DB2onRails
xTech2006_DB2onRailsxTech2006_DB2onRails
xTech2006_DB2onRailswebuploader
 
Stored-Procedures-Presentation
Stored-Procedures-PresentationStored-Procedures-Presentation
Stored-Procedures-PresentationChuck Walker
 
Global Azure Bootcamp 2017 - Why I love S2D for MSSQL on Azure
Global Azure Bootcamp 2017 - Why I love S2D for MSSQL on AzureGlobal Azure Bootcamp 2017 - Why I love S2D for MSSQL on Azure
Global Azure Bootcamp 2017 - Why I love S2D for MSSQL on AzureKarim Vaes
 
Reliability and performance with ibm db2 analytics accelerator
Reliability and performance with ibm db2 analytics acceleratorReliability and performance with ibm db2 analytics accelerator
Reliability and performance with ibm db2 analytics acceleratorbupbechanhgmail
 
Guob consolidation implementation11gr2
Guob consolidation implementation11gr2Guob consolidation implementation11gr2
Guob consolidation implementation11gr2Rodrigo Almeida
 
Leveraging Open Source to Manage SAN Performance
Leveraging Open Source to Manage SAN PerformanceLeveraging Open Source to Manage SAN Performance
Leveraging Open Source to Manage SAN Performancebrettallison
 
DB2 for z/O S Data Sharing
DB2 for z/O S  Data  SharingDB2 for z/O S  Data  Sharing
DB2 for z/O S Data SharingSurekha Parekh
 
Building data pipelines at Shopee with DEC
Building data pipelines at Shopee with DECBuilding data pipelines at Shopee with DEC
Building data pipelines at Shopee with DECRim Zaidullin
 
Build a Big Data solution using DB2 for z/OS
Build a Big Data solution using DB2 for z/OSBuild a Big Data solution using DB2 for z/OS
Build a Big Data solution using DB2 for z/OSJane Man
 
1 extreme performance - part i
1   extreme performance - part i1   extreme performance - part i
1 extreme performance - part isqlserver.co.il
 
JCL BEYOND DFSORT
JCL BEYOND DFSORTJCL BEYOND DFSORT
JCL BEYOND DFSORTNirmal Pati
 
DB2 Performance Tuning Z/OS - email me please for more details
DB2 Performance Tuning Z/OS - email me please for more detailsDB2 Performance Tuning Z/OS - email me please for more details
DB2 Performance Tuning Z/OS - email me please for more detailsManikandan Suresh
 

Similar to SQL Performance for DB2: Diagnose RIDPool Failures Causing Tablespace Scans (20)

Identify SQL Tuning Opportunities
Identify SQL Tuning OpportunitiesIdentify SQL Tuning Opportunities
Identify SQL Tuning Opportunities
 
Gaining Insight into
Gaining Insight intoGaining Insight into
Gaining Insight into
 
Track 2 session 4 db2 for z os optimizer- what’s new in db2 11 and exploiti...
Track 2 session 4   db2 for z os optimizer- what’s new in db2 11 and exploiti...Track 2 session 4   db2 for z os optimizer- what’s new in db2 11 and exploiti...
Track 2 session 4 db2 for z os optimizer- what’s new in db2 11 and exploiti...
 
DB2 Real-Time Analytics Meeting Wayne, PA 2015 - IDAA & DB2 Tools Update
DB2 Real-Time Analytics Meeting Wayne, PA 2015 - IDAA & DB2 Tools UpdateDB2 Real-Time Analytics Meeting Wayne, PA 2015 - IDAA & DB2 Tools Update
DB2 Real-Time Analytics Meeting Wayne, PA 2015 - IDAA & DB2 Tools Update
 
Hariharan_Resume
Hariharan_ResumeHariharan_Resume
Hariharan_Resume
 
xTech2006_DB2onRails
xTech2006_DB2onRailsxTech2006_DB2onRails
xTech2006_DB2onRails
 
Stored-Procedures-Presentation
Stored-Procedures-PresentationStored-Procedures-Presentation
Stored-Procedures-Presentation
 
Global Azure Bootcamp 2017 - Why I love S2D for MSSQL on Azure
Global Azure Bootcamp 2017 - Why I love S2D for MSSQL on AzureGlobal Azure Bootcamp 2017 - Why I love S2D for MSSQL on Azure
Global Azure Bootcamp 2017 - Why I love S2D for MSSQL on Azure
 
Reliability and performance with ibm db2 analytics accelerator
Reliability and performance with ibm db2 analytics acceleratorReliability and performance with ibm db2 analytics accelerator
Reliability and performance with ibm db2 analytics accelerator
 
Guob consolidation implementation11gr2
Guob consolidation implementation11gr2Guob consolidation implementation11gr2
Guob consolidation implementation11gr2
 
Windows server Interview question and answers
Windows server Interview question and answersWindows server Interview question and answers
Windows server Interview question and answers
 
Leveraging Open Source to Manage SAN Performance
Leveraging Open Source to Manage SAN PerformanceLeveraging Open Source to Manage SAN Performance
Leveraging Open Source to Manage SAN Performance
 
DB2 for z/O S Data Sharing
DB2 for z/O S  Data  SharingDB2 for z/O S  Data  Sharing
DB2 for z/O S Data Sharing
 
Building data pipelines at Shopee with DEC
Building data pipelines at Shopee with DECBuilding data pipelines at Shopee with DEC
Building data pipelines at Shopee with DEC
 
Sap
SapSap
Sap
 
Build a Big Data solution using DB2 for z/OS
Build a Big Data solution using DB2 for z/OSBuild a Big Data solution using DB2 for z/OS
Build a Big Data solution using DB2 for z/OS
 
1 extreme performance - part i
1   extreme performance - part i1   extreme performance - part i
1 extreme performance - part i
 
JCL BEYOND DFSORT
JCL BEYOND DFSORTJCL BEYOND DFSORT
JCL BEYOND DFSORT
 
DB2 Performance Tuning Z/OS - email me please for more details
DB2 Performance Tuning Z/OS - email me please for more detailsDB2 Performance Tuning Z/OS - email me please for more details
DB2 Performance Tuning Z/OS - email me please for more details
 
Db2 v10.5 An Overview
Db2 v10.5 An OverviewDb2 v10.5 An Overview
Db2 v10.5 An Overview
 

More from Cuneyt Goksu

Makine Düsünebilir mi
Makine Düsünebilir miMakine Düsünebilir mi
Makine Düsünebilir miCuneyt Goksu
 
Db2 for z os trends
Db2 for z os trendsDb2 for z os trends
Db2 for z os trendsCuneyt Goksu
 
Db2 analytics accelerator technical update
Db2 analytics accelerator  technical updateDb2 analytics accelerator  technical update
Db2 analytics accelerator technical updateCuneyt Goksu
 
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaaPerfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaaCuneyt Goksu
 
How should I monitor my idaa
How should I monitor my idaaHow should I monitor my idaa
How should I monitor my idaaCuneyt Goksu
 
Ibm machine learning for z os
Ibm machine learning for z osIbm machine learning for z os
Ibm machine learning for z osCuneyt Goksu
 
Machine Learning for z/OS
Machine Learning for z/OSMachine Learning for z/OS
Machine Learning for z/OSCuneyt Goksu
 
Temporal Tables, Transparent Archiving in DB2 for z/OS and IDAA
Temporal Tables, Transparent Archiving in DB2 for z/OS and IDAATemporal Tables, Transparent Archiving in DB2 for z/OS and IDAA
Temporal Tables, Transparent Archiving in DB2 for z/OS and IDAACuneyt Goksu
 
Seçsi̇s sistemi hakkında değerlendirme ve öneriler
Seçsi̇s sistemi hakkında değerlendirme ve önerilerSeçsi̇s sistemi hakkında değerlendirme ve öneriler
Seçsi̇s sistemi hakkında değerlendirme ve önerilerCuneyt Goksu
 
Sosyal Medya ve Yeni Örgütlenmeler
Sosyal Medya ve Yeni ÖrgütlenmelerSosyal Medya ve Yeni Örgütlenmeler
Sosyal Medya ve Yeni ÖrgütlenmelerCuneyt Goksu
 
Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...
Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...
Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...Cuneyt Goksu
 
Denver 2012 -- After IDUG Conference
Denver 2012 -- After IDUG ConferenceDenver 2012 -- After IDUG Conference
Denver 2012 -- After IDUG ConferenceCuneyt Goksu
 
BIG DATA Nedir ve IBM Çözümleri.
BIG DATA Nedir ve IBM Çözümleri.BIG DATA Nedir ve IBM Çözümleri.
BIG DATA Nedir ve IBM Çözümleri.Cuneyt Goksu
 
Occupy wall street
Occupy wall streetOccupy wall street
Occupy wall streetCuneyt Goksu
 
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OSPractical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OSCuneyt Goksu
 
Real-life DB2 tuning experİences with Apptune
Real-life DB2 tuning experİences with ApptuneReal-life DB2 tuning experİences with Apptune
Real-life DB2 tuning experİences with ApptuneCuneyt Goksu
 

More from Cuneyt Goksu (20)

Home Office
Home OfficeHome Office
Home Office
 
Makine Düsünebilir mi
Makine Düsünebilir miMakine Düsünebilir mi
Makine Düsünebilir mi
 
WhatsApp nedir
WhatsApp nedirWhatsApp nedir
WhatsApp nedir
 
Db2 for z os trends
Db2 for z os trendsDb2 for z os trends
Db2 for z os trends
 
Db2 analytics accelerator technical update
Db2 analytics accelerator  technical updateDb2 analytics accelerator  technical update
Db2 analytics accelerator technical update
 
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaaPerfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
 
How should I monitor my idaa
How should I monitor my idaaHow should I monitor my idaa
How should I monitor my idaa
 
Ibm machine learning for z os
Ibm machine learning for z osIbm machine learning for z os
Ibm machine learning for z os
 
Machine Learning for z/OS
Machine Learning for z/OSMachine Learning for z/OS
Machine Learning for z/OS
 
Temporal Tables, Transparent Archiving in DB2 for z/OS and IDAA
Temporal Tables, Transparent Archiving in DB2 for z/OS and IDAATemporal Tables, Transparent Archiving in DB2 for z/OS and IDAA
Temporal Tables, Transparent Archiving in DB2 for z/OS and IDAA
 
Seçsi̇s sistemi hakkında değerlendirme ve öneriler
Seçsi̇s sistemi hakkında değerlendirme ve önerilerSeçsi̇s sistemi hakkında değerlendirme ve öneriler
Seçsi̇s sistemi hakkında değerlendirme ve öneriler
 
Sosyal Medya ve Yeni Örgütlenmeler
Sosyal Medya ve Yeni ÖrgütlenmelerSosyal Medya ve Yeni Örgütlenmeler
Sosyal Medya ve Yeni Örgütlenmeler
 
Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...
Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...
Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...
 
Denver 2012 -- After IDUG Conference
Denver 2012 -- After IDUG ConferenceDenver 2012 -- After IDUG Conference
Denver 2012 -- After IDUG Conference
 
BIG DATA Nedir ve IBM Çözümleri.
BIG DATA Nedir ve IBM Çözümleri.BIG DATA Nedir ve IBM Çözümleri.
BIG DATA Nedir ve IBM Çözümleri.
 
Nato ve medya
Nato ve medyaNato ve medya
Nato ve medya
 
Occupy wall street
Occupy wall streetOccupy wall street
Occupy wall street
 
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OSPractical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
 
Vietnam 2011
Vietnam 2011Vietnam 2011
Vietnam 2011
 
Real-life DB2 tuning experİences with Apptune
Real-life DB2 tuning experİences with ApptuneReal-life DB2 tuning experİences with Apptune
Real-life DB2 tuning experİences with Apptune
 

SQL Performance for DB2: Diagnose RIDPool Failures Causing Tablespace Scans

  • 1. TECHNICAL WHITE PAPER Using SQL Performance for DB2: Diagnose RIDPool Failures
  • 2. Introduction These days, more and more Dynamic SQL is running on DB2 for z/OS and the proportion is increasing. Those SQL Statements are coming from a variety of applications and platforms. One thing all Dynamic SQL statements have in common is that before going into the DB2 Engine to be executed one of their stops is the Dynamic Statement Cache (DSC). The DSC is a storage pool in which DB2 saves prepared SQL statements access paths be shared among different threads, plans, and packages. By sharing those statements, applications can avoid unnecessary preparation processes and thus improve performance. After an SQL statement has been prepared the Statement Text and its access path are automatically saved in the cache. Subsequent prepare requests for that same SQL statement can avoid the costly preparation process by using the access path that’s already stored in the cache. There are several ways to identify Dynamic SQL statements in APPTUNE for DB2. If it’s a long running application, the “View current DB2 status by subsystem” menu shows running active threads. You can easily check for the DISTSERV Plan from “SUMMARY OF ACTIVE THREADS” screen and then drill down to find more details. If the thread is already completed, the “Analyze current and historical SQL workloads” menu shows near-Term History of threads. Another alternative is the “Analyze dynamic statement cache statistics” menu which is the main focus area of this section. It provides a general picture of dynamic statement cache performance at low cost with some additional functions. DETAILS... In order for the DSC metrics to be available, DB2 IFCID 318 must be active in a trace. IFCID 318 can be easily activated inside Apptune by using the DSC feature. You don’t need to keep it “active” all the time. In a heavy loaded system, activating it only for a few minutes provides plenty of valuable information. Identify a Tablespace Scan caused by a RID List failure, rather than its original access path. A tablespace scan is easily identified in DB2 Plan Table by a value of “R” in the Access Type column if this is the original access path. However, a more reasonable access path can also be converted into a tablespace scan at runtime, when it’s much harder to find. Let’s check the following scenario. IFCID 318 is activated for 14 seconds and data is collected for 13,672 SQL Calls as follows If you look at the detail of the collection period using the “T” drill down option, the following section gives you a good summary of the running SQL statements. If the number of “Tablespace Scans” and “Sorts Performed” are greater than zero, it means there are SQL Statements that are not using indexes efficiently or perhaps there is no valid Index at all. 1
  • 3. The next step is to check the SQL statements in the DSC, sorted by GETPAGE. It’s always very easy in Apptune to create an ordered list. Move your cursor on the Getpage column and press PF4 for ascending order or PF5 for descending. It’s likely that the statement with the highest average number of getpages is the one doing the Tablespace Scan and/or Sort operation. As a cautionary note, the Tablespace Scan field not only shows the access path itself, it also indicates when an SQL access path was changed into a Tablespace Scan after RID Pool failures. Be sure to check for this possibility before taking any action steps. See the example below. There is one SQL Statement whose Getpage count (1720) is significantly larger than the rest. Let’s check to see if there are any RIDPool failures. When the SQL statement (above) with the highest Getpages count is EXPLAINed (using the Explain option (X)) there is no Tablespace Scan shown. However you will see Multi-Index access and List Prefecth, which means the RIDPool will be used during execution 2
  • 4. SELECT * FROM FEE_CD A, FEE_STD B, FEE_MSTR_RATE D WHERE A.LDBID = ? AND A.LDBID = B.LDBID AND A.APRVL_VALUE = ‘appr’ AND A.FLST_VALUE = ‘actv’ AND A.FECD_EFCTV_DATE <= ? AND A.FECD_HOST_TS = (SELECT MAX(C.FECD_HOST_TS) FROM FEE_CD C WHERE C.LDBID = ? AND C.FECD_EFCTV_DATE <= ? AND C.CDN_IDFR = A.CDN_IDFR ) AND B.CDN_IDFR = A.CDN_IDFR_FECD_IS_D AND B.CRUD_VALUE <> ‘D’ AND B.FES_EFCTV_DATE <= ? AND B.CDN_IDFR = ? AND B.FES_HOST_TS = (SELECT MAX(FES_HOST_TS) FROM FEE_STD WHERE CDN_IDFR = B.CDN_IDFR AND FES_EFCTV_DATE <= ? ) AND D.LDBID = A.LDBID AND D.FEMR_IDFR = A.FEMR_IDFR AND D.FEMR_EFCTV_DATE <= ? AND D.APRVL_VALUE = ‘appr’ AND D.FEMR_HOST_TS = (SELECT MAX(FEMR_HOST_TS) FROM FEE_MSTR_RATE WHERE LDBID = ? AND FEMR_IDFR = D.FEMR_IDFR AND FEMR_EFCTV_DATE <= ? ) AND NOT EXISTS (SELECT 1 FROM FEE_PRFL_CD T4 WHERE T4.LDBID = ? AND T4.CDN_IDFR_FPC = A.CDN_IDFR 3
  • 5. AND T4.RIFS_IDFR = ? AND T4.FPC_HOST_TS = (SELECT MAX(FPC_HOST_TS) FROM FEE_PRFL_CD WHERE LDBID = ? AND CDN_IDFR = T4.CDN_IDFR ) ) ORDER BY FECD_NAME FOR READ ONLY When we look at the details of the SQL Statement, we see that there are 210 RID List failures 4
  • 6. As well as 210 Tablespace scan as follows. This proves that the cause of those tablespace scans are are RIDPool failures rather than the original path, and it would be very difficult to determine this without execution statistics at the Statement level. The next steps should be to check the related RID Pool DSNPARM settings to determine whether changing these may help, as well as evaluating the Statement itself to determine whether the dependence on the RID pool can be reduced. About the Author IBM Champion Cuneyt Goksu is an independent DB2 specialist and IBM Gold Consultant since 2009. His main activity is linked to DB2 for z/OS and LUW Installation, Migration, Administration and Performance Tuning. He has presented papers at several conferences, local events and writing articles for IT magazines. Cuneyt is currently a member IDUG Board of Directors, he is the leader of Turkish DB2 Users Group and IBM Authorized DB2 Training Partner. Cuneyt can be reached at cuneytgoksu@usa.net 5
  • 7. Business Runs on I.T. I.T. Runs on BMC Software Business runs better when IT runs at its best. Tens of thousands of IT organizations around the world -- from small and mid-market businesses to the Global 100 -- rely on BMC Software (NASDAQ: BMC) to manage their business services and applications across distributed, mainframe, virtual and cloud environments. BMC helps customers cut costs, reduce risk and achieve business objectives with the broadest choice of IT management solutions, including industry-leading Business Service Management and Cloud Management offerings. For the four fiscal quarters ended September 30, 2012, BMC revenue was approximately $2.2 billion. www.bmc.com BMC, BMC Software, and the BMC Software logo are the exclusive properties of BMC Software, Inc., are registered with the U.S. Patent and Trademark Office, and may be registered or pending registration in other countries. All other BMC trademarks, service marks, and logos may be registered or pending registration in the U.S. or in other countries. Linux is the registered trademark of Linus Torvalds. All other trademarks or registered trademarks are the property of their respective owners. © 2012 BMC Software, Inc. All rights reserved. Origin date: 1/13 *357593*