Gaining Insight into

325 views

Published on

Gaining Insight into
Stored Procedure Characteristics with Apptune

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
325
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Gaining Insight into

  1. 1. TECHNICAL WHITE PAPERUsing SQL Performance for DB2:Gaining Insight intoStored Procedure Characteristics
  2. 2. IntroductionStored Procedures, User Defined Functions and Triggers, collectively called “routines”, have been an integralpart of the programming inventory for some time. Depending upon your Application Programming Architecturesome routines, such as WLM-Managed External Stored Procedures, will run outside of DB2. Others, notablyNative SQL Stored Procedures and triggers, execute within a DB2 managed address space and as a result youhave more control over how they perform. Tuning such internal routines is often very similar to tuning any otherpackages or SQLs but there are some significant differences too. For instance Non-SQL CPU used by a WLMManaged Cobol Stored Procedure which does a lot of CPU Intensive work using a complex business Algorithm ischarged to the Allied Address Space (AS), whereas a native SQL procedure with the same complexity increasesthe CPU usage of the DBM1 AS. Both behaviors require different measuring and tuning techniques. During thisdiscussion 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 iscalling 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 theprocedure is executing as an External SP or Native SQL SP. The “Pgm Type” column value STPR means StoredProcedure 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 DETAILANALYSIS” screen. At the bottom of this there is a section called “Stored Procedure/WLM Address Space”. If youcan see values other than zero in “Elapsed Time” or “Total SQL operations”, then this tells you that you’re lookingat an External Stored Procedure. 1
  3. 3. For instance in the example above the GET_DAILY_TOTAL_CUST_GROUP (the name has been truncatedto GET_DA>>) procedure is an WLM Managed External Stored Procedure, whereas the screen shot belowis from another procedure’s detail and the values circled in red here indicate that this is a Native SQL SPSometimes it is important to know from where a procedure is CALLed or invoked. For instance a SP can be calledfrom Distributed Environment through DDF, from a Batch job, or from an online CICS or IMS/TM program usingCobol. From a tuning perspective it’s important to know the caller’s application environment. For instance if weuse 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 theplan name would be DISTSERV. 2
  4. 4. It is also important to distinguish the type of incoming transactions. For instance what is the percentageof incoming workload from Distributed compared to Batch/CICS/IMS? Knowing this percentage helps youto focus on which section of the DB2 Subsystem needs more tuning. The following secreen shot is a PLANANALYSIS report of 2-way datasharing group. As you’ll see from one hour consolidated report more than90% of the work this group is processing are Distributed Transactions coming from DDF. 3
  5. 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. 6. Business Runs on I.T. I.T. Runs on BMC SoftwareBusiness runs better when IT runs at its best. Tens of thousands of IT organizations around the world -- fromsmall and mid-market businesses to the Global 100 -- rely on BMC Software (NASDAQ: BMC) to manage theirbusiness services and applications across distributed, mainframe, virtual and cloud environments. BMC helpscustomers cut costs, reduce risk and achieve business objectives with the broadest choice of IT managementsolutions, including industry-leading Business Service Management and Cloud Management offerings. For thefour fiscal quarters ended September 30, 2012, BMC revenue was approximately $2.2 billion. www.bmc.comBMC, 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 beregistered 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 othercountries. 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*

×