MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Access path

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
danm
Intermediate


Joined: 29 Jun 2004
Posts: 170
Topics: 73

PostPosted: Thu Apr 29, 2010 10:05 am    Post subject: Access path Reply with quote

I am joining 3 tables (all of them have index). Explain shows ACCESSTYPE for table1 and table3 are "I", while it is "R" for table2. All tables has a 9 character column (COL1) as the first column in the index. I try different tricks (e.g. for optizime 1 row) and table2 always uses table scan. The only way I can force index scan to be used on table2 is to include "AND Tablen.COL1 between '000000000' and '999999999'" in the where clause (n = 1, 2 or 3). What else can I try?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Apr 29, 2010 10:47 am    Post subject: Reply with quote

danm,

Alter table 2 to "Volatile cardinality" and it will force the INDEX scan. By declaring the table volatile, the optimizer will consider using index scan rather than table scan. The access plans that use declared volatile tables will not depend on the existing statistics for that table. check this link

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/dsnagj11/5.7.8.4?

btw if you do want to use a hint , a simpler option is

Code:

Index_col > CHAR('0')

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group