Svenson's  Bulletin Board Forum Index Svenson's Bulletin Board
Bulletin Board for boat building and model airplane building enthusiasts.
 
AlbumAlbum   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SQL to get num_execs / rows read percentage

 
Post new topic   Reply to topic    Svenson's Bulletin Board Forum Index -> DB2
View previous topic :: View next topic  
Author Message
craig
Site Admin


Joined: 19 Feb 2006
Posts: 40

PostPosted: Wed Nov 17, 2010 3:06 pm    Post subject: SQL to get num_execs / rows read percentage Reply with quote

The following sql will return a percentage of rows read per execution. High rate may indicate indexing opportunities. It could also be from group by's or sums or such.


select cast(100-(cast((cast(num_executions as double) / cast(rows_read as double)) as double) *100) as decimal(5,2))
,rows_read
,num_executions
,total_exec_time,stmt_sorts
,cast(stmt_text as clob) as stmt_text
from table(snapshot_dyn_sql('',-2)) as s
where rows_read > 0
and rows_read > num_executions
and cast(100-(cast((cast(num_executions as double) / cast(rows_read as double)) as double) *100) as decimal(5,2)) > 20
order by 1 desc,num_executions desc
Back to top
View user's profile Send private message Send e-mail
superman7



Joined: 03 Jan 2014
Posts: 1

PostPosted: Fri Jan 03, 2014 4:19 am    Post subject: Reply with quote

,total_exec_time,stmt_sorts
and rows_read > num_executions
_________________
Smile PleazZZZzzzZZZzzzz……
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Svenson's Bulletin Board Forum Index -> DB2 All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group