473,722 Members | 2,459 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to find Execution time of Select, Insert and Update in stored procedures

Env: DB2 UDB 8.1 on AIX

We are executing a db2 sql stored procedure which is invoked from a
java client. The stored procedure contains few select, insert and
update statements.

Using the DB2 snapshot and event monitor we are able to find the time
taken for the stored procedure execution.

We want to find what is the execution time for each
select,insert,u pdate statement within the stored procedure. We were not
able to find a way to do the same?

tariq

Jan 25 '06 #1
3 10907
One could possible intiate the "event monitor over statements" and then
log the statements information

Jan 25 '06 #2
event monitor for statements (add where clause to minimize output).
Typically in LUW every operator in SP converted to static sql and
stored in package. Package name like SCHEMA.Pxxxxxxx , where xxxxxxx -
number.

You can get procedure name by sql (create a function)

SELECT rtrim(rtrim(pro cschema)||'.'|| procname)
from SYSCAT.ROUTINED EP rd inner join SYSIBM.SYSPROCE DURES sp on
(rd.ROUTINESCHE MA, rd.ROUTINENAME ) =
(sp.PROCSCHEMA, sp.SPECIFICNAME )
where rd.BTYPE='K'
and rtrim(rtrim(rd. BSCHEMA) || '.' || rd.BNAME) = UCASE(
Package_Name)

By package section you can found real sql

SELECT TEXT FROM SYSIBM.SYSSTMT
where RTRIM(PLCREATOR ) ||'.'|| RTRIM(PLNAME) = UCASE(Package_N ame)
and SectNo = sect )

I can't say about AIX, but event monitor output in LUW like this
sp call:

*) Statement Event ...
Appl Handle: 1
Appl Id: APPL_ID
Appl Seq number: 0105

Record is the result of a flush: FALSE
-------------------------------------------
Type : Dynamic
Operation: Prepare
Section : 4
Creator : NULLID
Package : SYSSH200
Consistency Token : SYSLVL01
Package Version ID :
Cursor : SQL_CURSH200C4
Cursor was blocking: FALSE
Text : CALL SO.SO_PAGE_ACCE SS(?)
-------------------------------------------
Start Time: 13.12.2005 13:39:41.878441
Stop Time: 13.12.2005 13:39:41.878633
Exec Time: 0.000192 seconds
Number of Agents created: 1
User CPU: 0.000000 seconds
System CPU: 0.000000 seconds
Fetch Count: 0
Sorts: 0
Total sort time: 0
Sort overflows: 0
Rows read: 0
Rows written: 0
Internal rows deleted: 0
Internal rows updated: 0
Internal rows inserted: 0
Bufferpool data logical reads: 0
Bufferpool data physical reads: 0
Bufferpool temporary data logical reads: 0
Bufferpool temporary data physical reads: 0
Bufferpool index logical reads: 0
Bufferpool index physical reads: 0
Bufferpool temporary index logical reads: 0
Bufferpool temporary index physical reads: 0
SQLCA:
sqlcode: 0
sqlstate: 00000

Then You see body for SP: this is first cursor in SP.

*) Statement Event ...
Appl Handle: 1
Appl Id: APPL_ID
Appl Seq number: 0105

Record is the result of a flush: FALSE
-------------------------------------------
Type : Static
Operation: Open
Section : 1
Creator : SO
Package : P3594943
Consistency Token : tAx8NeGV
Package Version ID :
Cursor : SO_PAGE_ACCESS_ C
Cursor was blocking: TRUE
-------------------------------------------
Start Time: 13.12.2005 13:39:41.879779
Stop Time: 13.12.2005 13:39:41.879814
Exec Time: 0.000035 seconds
Number of Agents created: 1
User CPU: 0.000000 seconds
System CPU: 0.000000 seconds
Fetch Count: 0
Sorts: 0
Total sort time: 0
Sort overflows: 0
Rows read: 0
Rows written: 0
Internal rows deleted: 0
Internal rows updated: 0
Internal rows inserted: 0
Bufferpool data logical reads: 0
Bufferpool data physical reads: 0
Bufferpool temporary data logical reads: 0
Bufferpool temporary data physical reads: 0
Bufferpool index logical reads: 0
Bufferpool index physical reads: 0
Bufferpool temporary index logical reads: 0
Bufferpool temporary index physical reads: 0
SQLCA:
sqlcode: 0
sqlstate: 00000
Andy

Jan 25 '06 #3
taru wrote:
Env: DB2 UDB 8.1 on AIX

We are executing a db2 sql stored procedure which is invoked from a
java client. The stored procedure contains few select, insert and
update statements.

Using the DB2 snapshot and event monitor we are able to find the time
taken for the stored procedure execution.

We want to find what is the execution time for each
select,insert,u pdate statement within the stored procedure. We were not
able to find a way to do the same?

"Profiling SQL Procedures"
http://www-128.ibm.com/developerwork...dm-0406rielau/

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
DB2 UDB for Linux, Unix, Windows
IBM Toronto Lab
Jan 25 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
1913
by: Simon Harris | last post by:
Hi All, Ok - I'll confess from the start, this is more about application logic that ASP, being an ASP programmer, I guessed you people might be able to help! :) I have built a room bookings system, based on ASP/SQL Server. Bookings are stored in a table, which holds start date+time and End date+time, amougst other info. Bookings can run from 8:30 - midnight, and are always made in 30 min blocks (e.g. 14:30 - 15:30 etc)
1
2551
by: compraj | last post by:
I was using the SQL 2000 stored procedure wizard to create stored procedures. I can create insert, delete and update SPs however I am not able to create the select SP. The wizard does not offer the option of selecting "select" type SP. thank you for your replys compraj
1
6619
by: Jim Geissman | last post by:
Help, please. I am trying to update a table with this structre: CREATE TABLE Queue (PropID int, EffDate smalldatetime, TxnAmt int) INSERT Queue (PropID) SELECT 1 INSERT Queue (PropID) SELECT 2 INSERT Queue (PropID) SELECT 3
1
2136
by: tonci.tomic | last post by:
I have windows service running on win2000 and client applications on local network connected to service via remoting. Service acts as interface to MSSQL 2000 database and it uses Microsoft Data Application Block. Every few days data block throws timeout exception during the insert (and very rarely even during select). After that every subsequent insert from any client, even from client residig on the same machine as service, throws the...
18
10301
by: Robin Lawrie | last post by:
Hi again, another problem! I've moved from an Access database to SQL server and am now having trouble inserting dates and times into seperate fields. I'm using ASP and the code below to get the date and time, but my script is erroring. '-- Get login date and time cmdLoginDate = Date() cmdLoginTime = Time()
2
3332
by: Eli | last post by:
Hi all We currently have a strange problem with calling a Stored Procedure (SQL Database) in our C# Project. The only error I get is "System error" which says a lot :) Background: We have several stored procedures to Insert and update datas in our SQL database. Some stored procedures are smaller (insert datas in only one table) and some of them are quite big (insert datas in several
2
3879
by: kennethgrice | last post by:
Hi, I am new to ASP.net and visual studio.net. I have created a new ASP.NET Web Application and have started with a simple form. I have created a simple test database that will store a person's first and last name and their SSN. The primary key is an autonumbered field.
2
1393
by: elaine | last post by:
I'm working on a .net web application. The architect of this web application is quite different than other web applications i worked before. Since we use a set of tools to generate most of the basic code. Every table in the database related to an object in the application. There is no stored procedures in database; In every object of the application, the tool generates methods for basic database operations like insert, delete, update,...
7
3205
by: Matt | last post by:
So as you all know the great thing about ADO.NET is that I can take an entire table from a database and dump it into an in memory datatable using ADO.NET. Well my question is that now that I have this temporary table, is it possible to run SQL commands against it like it were an "actual" table. To give a simplistic example, lets say I have a table in my SQL Server database called "Customers" that contains 2 columns (CustomerID,
0
8863
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8739
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9238
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9157
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6681
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5995
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3207
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2602
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.