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

Access Path Selection - Help Needed


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

New User


Joined: 11 Jul 2005
Posts: 87

PostPosted: Wed Jul 28, 2010 10:46 am
Reply with quote

Hi,

One of my job uses a REXX utility step which executes a DB2 query. It was running for more than 5 hours and we cancelled the job.

When we ran the same query again after sometime it ran within 1 hour.

We did a EXPLAIN and we did not see any hot spots.

Our DBA tells us that

Quote:
"It looks like the BD2 access path took a turn for the worse which can happen from time to time with dynamic sql".


But the query by itself is not dynamic only the plan get created dynamically. Can we still say it is dynamic query?

Code:
My question is will access path gets changed dynamically? if so can we force Db2 to select the optimal access path?

Can some please help me in understand the selection of access path.

PS: I think DB2 optimizer will select the best available optimal path?

Your help is really appreciated.

Regards,
Chinni
Back to top
View user's profile Send private message
sambit_mech

New User


Joined: 14 Jul 2010
Posts: 13
Location: India

PostPosted: Wed Jul 28, 2010 11:04 am
Reply with quote

I think your bind card contains VALIDATE(RUN) instead of VALIDATE(BIND).
Back to top
View user's profile Send private message
chinnielr

New User


Joined: 11 Jul 2005
Posts: 87

PostPosted: Wed Jul 28, 2010 11:18 am
Reply with quote

No there is no BIND card for this. This is just a query getting executed from a step.

Regards,
Chinni
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 28, 2010 2:10 pm
Reply with quote

a little reading is in order, for all of you:

start with the IBM REDBOOK Squeezing the Most Out of Dynamic SQL with DB2 for z/OS and OS/390

I believe a thorough read will answer all of your questions,
and correct your miss-conceptions.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Wed Jul 28, 2010 4:38 pm
Reply with quote

afaik Rexx is always dynamic.

Access path should/can only change if some statistics have been run on the underlying tables
Back to top
View user's profile Send private message
chinnielr

New User


Joined: 11 Jul 2005
Posts: 87

PostPosted: Wed Jul 28, 2010 6:47 pm
Reply with quote

Thanks for your quick responses. Can you please let me know whether we can force DB2 to select the opimal access path? Not sure if we can do so.

Regards,
Chinni.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Wed Jul 28, 2010 6:55 pm
Reply with quote

there are some techniques to make DB2 favor some indexes or some tables as outer table like " or 0=1"

otherwise SET CURRENT OPTIMIZATION HINT might do the trick if you can figure it out : publib.boulder.ibm.com/infocenter/dzichelp/v2r2/topic/com.ibm.db2.doc.admin/p9li375.htm#p9li375
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 28, 2010 6:56 pm
Reply with quote

Giving optimization hints to DB2 VSN 8
Giving optimization hints to DB2 VSN 9

article on db2 optimization hints
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 Access to non cataloged VSAM file JCL & VSAM 18
No new posts How to access web services/website? Mainframe Interview Questions 4
No new posts SET PATH in View DDL DB2 2
No new posts Mainframe Programmer with CICS Skill... Mainframe Jobs 0
No new posts access the last host command CLIST & REXX 2
Search our Forums:

Back to Top