IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How can we find the timing of an particular sql query


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kutty.r

New User


Joined: 22 Jun 2006
Posts: 24

PostPosted: Fri Sep 08, 2006 10:34 pm
Reply with quote

hi,

how can we find the timing of an particular sql query. i want to know how long an particular query executed ( how to find ?).
Back to top
View user's profile Send private message
raghunathns

Active User


Joined: 08 Dec 2005
Posts: 127
Location: rochester

PostPosted: Fri Sep 08, 2006 10:39 pm
Reply with quote

if you execute in qmf you will get the query cost before execution
Back to top
View user's profile Send private message
kutty.r

New User


Joined: 22 Jun 2006
Posts: 24

PostPosted: Fri Sep 08, 2006 10:46 pm
Reply with quote

i need after executing an query how much time it takes to execute.

for ex: if i execute a query which fetches 1 row it takes xxxxx time to fetch the row . but if i execute a query which fetches 10,000 rows it surely takes more time to fetch the rows . so how to see the exact time taken by each query?
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Fri Sep 08, 2006 10:50 pm
Reply with quote

Hi,

Just give the below query before & after ur query in spufi & take out the time difference.

Select current_timestamp
from sysibm.sysdummy;
Back to top
View user's profile Send private message
raghunathns

Active User


Joined: 08 Dec 2005
Posts: 127
Location: rochester

PostPosted: Sat Sep 09, 2006 12:06 am
Reply with quote

i thought you are looking for query cost.

for your question. ekta answer is ok i believe.
Back to top
View user's profile Send private message
srinivas_y

New User


Joined: 18 Oct 2005
Posts: 1

PostPosted: Wed Sep 13, 2006 10:16 am
Reply with quote

I dont think the answer is correct.

If you could use explain statement then it would drive you in finding out correct answer.

Let me know if you need further info.

Regards,
S...
Back to top
View user's profile Send private message
raghunathns

Active User


Joined: 08 Dec 2005
Posts: 127
Location: rochester

PostPosted: Wed Sep 13, 2006 9:27 pm
Reply with quote

explain will give you
how it is accessing the data. which index is used that kind of info.

not the
time taken to extract one row
time taken to extract 1000 rows.
Back to top
View user's profile Send private message
kgumraj

Active User


Joined: 01 May 2006
Posts: 151
Location: Hyderabad

PostPosted: Wed Sep 13, 2006 10:10 pm
Reply with quote

It may be helpful but it uses DB2 so defenetly the time is not true

SELECT CURRENT TIMESTAMP INTO :A-VAR FROM SYSIBM.SYSDUMMY1;

<YOUR QUERY>

SELECT CURRENT TIMESTAMP INTO :B-VAR FROM SYSIBM.SYSDUMMY1;

SUBTRACT A-VAR FROM B-VAR GIVING C-VAR

DISPLAY 'THE TIME OF EXECUTION IS' C-VAR
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
Search our Forums:

Back to Top