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 

make "IS NULL" not indexable

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


Joined: 31 Jan 2003
Posts: 211
Topics: 8

PostPosted: Wed Mar 30, 2005 8:17 am    Post subject: make "IS NULL" not indexable Reply with quote

I have a pretty komplex query touching 10 big tables. The optimizer chooses to start with a bad index access on a table: both index columns are defined as nullable, and my search criteria needs to have both columns having the NULL value.

The pitty is, that 2/3 of the rows in the table posses this combination.

I have no chance to create propper statistic values for these index columns, since I have no access to our DBAs.

The alternative I come to think of is to make these predicates "not indexable". Forcing this attribute for normal comparing operations (=, >=, etc.) for numeric, character or date/time formats is no problem.

The question is: How can I achieve the status "not indexable" for a predicate "column IS NULL"?

kind regards
Christian
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: Wed Mar 30, 2005 9:01 am    Post subject: Reply with quote

Czerfas,

There are many ways to make a predicate nonindexable. The recommended way is to make the add 0 to a predicate that evaluates to a numeric value or concatenate a predicate that evaluates to a character value with an empty string.

Code:

Indexable                    Nonindexable                                   
T1.C3=T2.C4                     (T1.C3=T2.C4 CONCAT '')                                             
T1.C1=5                      T1.C1=5+0                                       


T stands for table and C stands for column in the above example. These techniques do not affect the result of the query and cause only a small amount of overhead.

Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/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