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

DB2 Statistics - Using EXPLAIN and querying the results


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

New User


Joined: 11 Nov 2019
Posts: 10
Location: USA

PostPosted: Mon May 08, 2023 7:38 pm
Reply with quote

Hello All,

I am trying to gather metrics for analyzing DB2 Query performance and I am hitting unforeseen roadblocks.

When using the EXPLAIN parameter as part of my DB2 QUERY [Example below], I expected the DSN_STATEMENT_TABLE and the PLAN_TABLE to both populate rows with the appropriate values.
The PLAN_TABLE created new entries for each execution of my SQL. Wonderful!

The DSN_STATEMENT_TABLE did not. No Joy there.. icon_sad.gif


Code:
EXPLAIN ALL SET QUERYNO=444 FOR


Here is the statement I'm executing to gather statistics. it runs fine yet returns 0 Rows.

Code:
SELECT                             
    DST.EXPLAIN_TIME,               
    DST.STMT_TYPE,                 
    DST.PROCMS,                     
    DST.PROCSU,                     
    DST.TOTAL_COST,                 
    DUT.STMT_ID,                   
    DUT.STATEMENT                   
 FROM SYSIBM.DSN_STATEMNT_TABLE  DST
JOIN SYSIBM.SYSPACKSTMT         DUT
   ON DST.PER_STMT_ID = DUT.STMT_ID
 WITH UR                           
;                                   



This is obviously a DB2 setup issue and since we have no DB2 admin on staff anymore (Upper Management let the wrong people go!), it's left to the developers to fill the void.

Would anyone be able to point me in any direction that would be beneficial?

Regards,
-Ron
Back to top
View user's profile Send private message
guptae

Moderator


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

PostPosted: Tue May 16, 2023 2:51 pm
Reply with quote

Hello Ron,

Please try below

Code:
SELECT                             
    DST.EXPLAIN_TIME,               
    DST.STMT_TYPE,                 
    DST.PROCMS,                     
    DST.PROCSU,                     
    DST.TOTAL_COST,                 
 FROM SYSIBM.DSN_STATEMNT_TABLE  DST
 WHERE QUERYNO =444;


Check if it works?
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 Extracting Compression Statistics fro... PL/I & Assembler 2
No new posts Program level statistics CICS 6
No new posts COBOL NOADVANCING strange results in ... COBOL Programming 4
No new posts CICS Performance statistics CICS 3
No new posts partitioning row-num and aggregation ... DB2 0
Search our Forums:

Back to Top