SlideShare a Scribd company logo
TECHNICAL WHITE PAPER




Using SQL Performance for DB2:
Gaining Insight into
Stored Procedure Characteristics
Introduction
Stored Procedures, User Defined Functions and Triggers, collectively called “routines”, have been an integral
part of the programming inventory for some time. Depending upon your Application Programming Architecture
some routines, such as WLM-Managed External Stored Procedures, will run outside of DB2. Others, notably
Native SQL Stored Procedures and triggers, execute within a DB2 managed address space and as a result you
have more control over how they perform. Tuning such internal routines is often very similar to tuning any other
packages or SQLs but there are some significant differences too. For instance Non-SQL CPU used by a WLM
Managed Cobol Stored Procedure which does a lot of CPU Intensive work using a complex business Algorithm is
charged to the Allied Address Space (AS), whereas a native SQL procedure with the same complexity increases
the CPU usage of the DBM1 AS. Both behaviors require different measuring and tuning techniques. During this
discussion we’ll focus how to use Apptune for DB2 reports to understand where the Stored Procedures (SPs)
are executing externally or internally with respect to DB2. We will then show how to tell what program or plan is
calling the stored procedure.


Is it External or Native Stored Procedure?
Before drilling down into any SP in an APPTUNE for DB2 online report, it’s a good idea to identify whether the
procedure is executing as an External SP or Native SQL SP. The “Pgm Type” column value STPR means Stored
Procedure in the reports as you can see in the example below.




Drilling down using the Details option (T) of the Program Analysis you will see the “SQL STATEMENT DETAIL
ANALYSIS” screen. At the bottom of this there is a section called “Stored Procedure/WLM Address Space”. If you
can see values other than zero in “Elapsed Time” or “Total SQL operations”, then this tells you that you’re looking
at an External Stored Procedure.




                                                       1
For instance in the example above the GET_DAILY_TOTAL_CUST_GROUP (the name has been truncated
to GET_DA>>) procedure is an WLM Managed External Stored Procedure, whereas the screen shot below
is from another procedure’s detail and the values circled in red here indicate that this is a Native SQL SP




Sometimes it is important to know from where a procedure is CALLed or invoked. For instance a SP can be called
from Distributed Environment through DDF, from a Batch job, or from an online CICS or IMS/TM program using
Cobol. From a tuning perspective it’s important to know the caller’s application environment. For instance if we
use the ( P ) Plan drilldown of the first SP whose name is GET_DA>>, we see a PLAN named POINET as follows.
This tells us that the Procedure is NOT being called from a standard Distributed Environment because if it was the
plan name would be DISTSERV.




                                                     2
It is also important to distinguish the type of incoming transactions. For instance what is the percentage
of incoming workload from Distributed compared to Batch/CICS/IMS? Knowing this percentage helps you
to focus on which section of the DB2 Subsystem needs more tuning. The following secreen shot is a PLAN
ANALYSIS report of 2-way datasharing group. As you’ll see from one hour consolidated report more than
90% of the work this group is processing are Distributed Transactions coming from DDF.




                                                     3
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




                                           4
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
                                                                                                                                                                              *357595*

More Related Content

PDF
IMS DC Self Study Complete Tutorial
PPT
PPTX
Skillwise-IMS DB
PDF
CMC-Visualizer for IBM Rational Team Concert
PPT
Business Process Management Salary Report
PPTX
Establishing a Business Process Management Center of Excellence - Impact 2012
PDF
BPM (Business Process Management), CRM and Cross-Functional Enterprise-Level ...
PPT
Fundamentals of Business Process Management: A Quick Introduction to Value-Dr...
IMS DC Self Study Complete Tutorial
Skillwise-IMS DB
CMC-Visualizer for IBM Rational Team Concert
Business Process Management Salary Report
Establishing a Business Process Management Center of Excellence - Impact 2012
BPM (Business Process Management), CRM and Cross-Functional Enterprise-Level ...
Fundamentals of Business Process Management: A Quick Introduction to Value-Dr...

Similar to Gaining Insight into (20)

PDF
Identify SQL Tuning Opportunities
PDF
Diagnose RIDPool Failures
PDF
Getting started with_data_studio_for_db2
PPT
DB2 UDB for z/OS Version 7 - An Overview
PDF
PDF
Database fundamentals
PDF
DbB 10 Webcast #3 The Secrets Of Scalability
PDF
DB210 Smarter Database IBM Tech Forum 2011
PDF
Db2 V8 Migration And New Functions
PDF
Vision 2016 fpm 1081 - getting data from sap business warehouse into your ibm...
PDF
Integrating BigInsights and Puredata system for analytics with query federati...
PDF
DB2 10 Webcast #1 - Overview And Migration Planning
PDF
DB2 10 Webcast #1 Overview And Migration Planning
PDF
51822208 bpm-portal-agentless-monitoring-v2-8
PDF
Ebs performance tune2_con9030_pdf_9030_0002
PPTX
Vision 2016 fpm 1072 - tips on using ibm cognos command center with ibm plann...
PDF
Sap fundamentals overview_for_sap_minors
PDF
Sqlref
PDF
System z Technology Summit Streamlining Utilities
Identify SQL Tuning Opportunities
Diagnose RIDPool Failures
Getting started with_data_studio_for_db2
DB2 UDB for z/OS Version 7 - An Overview
Database fundamentals
DbB 10 Webcast #3 The Secrets Of Scalability
DB210 Smarter Database IBM Tech Forum 2011
Db2 V8 Migration And New Functions
Vision 2016 fpm 1081 - getting data from sap business warehouse into your ibm...
Integrating BigInsights and Puredata system for analytics with query federati...
DB2 10 Webcast #1 - Overview And Migration Planning
DB2 10 Webcast #1 Overview And Migration Planning
51822208 bpm-portal-agentless-monitoring-v2-8
Ebs performance tune2_con9030_pdf_9030_0002
Vision 2016 fpm 1072 - tips on using ibm cognos command center with ibm plann...
Sap fundamentals overview_for_sap_minors
Sqlref
System z Technology Summit Streamlining Utilities
Ad

More from Cuneyt Goksu (20)

PDF
Home Office
PDF
Makine Düsünebilir mi
PDF
WhatsApp nedir
PDF
Db2 for z os trends
PDF
Db2 analytics accelerator technical update
PDF
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
PDF
How should I monitor my idaa
PDF
Ibm machine learning for z os
PDF
Machine Learning for z/OS
PDF
Temporal Tables, Transparent Archiving in DB2 for z/OS and IDAA
PDF
IDUG NA 2014 / 11 tips for DB2 11 for z/OS
PDF
Seçsi̇s sistemi hakkında değerlendirme ve öneriler
PDF
Sosyal Medya ve Yeni Örgütlenmeler
PDF
Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...
PDF
Denver 2012 -- After IDUG Conference
PDF
BIG DATA Nedir ve IBM Çözümleri.
PPTX
Nato ve medya
PDF
Occupy wall street
PDF
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
PDF
Vietnam 2011
Home Office
Makine Düsünebilir mi
WhatsApp nedir
Db2 for z os trends
Db2 analytics accelerator technical update
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
How should I monitor my idaa
Ibm machine learning for z os
Machine Learning for z/OS
Temporal Tables, Transparent Archiving in DB2 for z/OS and IDAA
IDUG NA 2014 / 11 tips for DB2 11 for z/OS
Seçsi̇s sistemi hakkında değerlendirme ve öneriler
Sosyal Medya ve Yeni Örgütlenmeler
Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...
Denver 2012 -- After IDUG Conference
BIG DATA Nedir ve IBM Çözümleri.
Nato ve medya
Occupy wall street
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
Vietnam 2011
Ad

Gaining Insight into

  • 1. TECHNICAL WHITE PAPER Using SQL Performance for DB2: Gaining Insight into Stored Procedure Characteristics
  • 2. Introduction Stored Procedures, User Defined Functions and Triggers, collectively called “routines”, have been an integral part of the programming inventory for some time. Depending upon your Application Programming Architecture some routines, such as WLM-Managed External Stored Procedures, will run outside of DB2. Others, notably Native SQL Stored Procedures and triggers, execute within a DB2 managed address space and as a result you have more control over how they perform. Tuning such internal routines is often very similar to tuning any other packages or SQLs but there are some significant differences too. For instance Non-SQL CPU used by a WLM Managed Cobol Stored Procedure which does a lot of CPU Intensive work using a complex business Algorithm is charged to the Allied Address Space (AS), whereas a native SQL procedure with the same complexity increases the CPU usage of the DBM1 AS. Both behaviors require different measuring and tuning techniques. During this discussion we’ll focus how to use Apptune for DB2 reports to understand where the Stored Procedures (SPs) are executing externally or internally with respect to DB2. We will then show how to tell what program or plan is calling the stored procedure. Is it External or Native Stored Procedure? Before drilling down into any SP in an APPTUNE for DB2 online report, it’s a good idea to identify whether the procedure is executing as an External SP or Native SQL SP. The “Pgm Type” column value STPR means Stored Procedure in the reports as you can see in the example below. Drilling down using the Details option (T) of the Program Analysis you will see the “SQL STATEMENT DETAIL ANALYSIS” screen. At the bottom of this there is a section called “Stored Procedure/WLM Address Space”. If you can see values other than zero in “Elapsed Time” or “Total SQL operations”, then this tells you that you’re looking at an External Stored Procedure. 1
  • 3. For instance in the example above the GET_DAILY_TOTAL_CUST_GROUP (the name has been truncated to GET_DA>>) procedure is an WLM Managed External Stored Procedure, whereas the screen shot below is from another procedure’s detail and the values circled in red here indicate that this is a Native SQL SP Sometimes it is important to know from where a procedure is CALLed or invoked. For instance a SP can be called from Distributed Environment through DDF, from a Batch job, or from an online CICS or IMS/TM program using Cobol. From a tuning perspective it’s important to know the caller’s application environment. For instance if we use the ( P ) Plan drilldown of the first SP whose name is GET_DA>>, we see a PLAN named POINET as follows. This tells us that the Procedure is NOT being called from a standard Distributed Environment because if it was the plan name would be DISTSERV. 2
  • 4. It is also important to distinguish the type of incoming transactions. For instance what is the percentage of incoming workload from Distributed compared to Batch/CICS/IMS? Knowing this percentage helps you to focus on which section of the DB2 Subsystem needs more tuning. The following secreen shot is a PLAN ANALYSIS report of 2-way datasharing group. As you’ll see from one hour consolidated report more than 90% of the work this group is processing are Distributed Transactions coming from DDF. 3
  • 5. 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 4
  • 6. 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 *357595*