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 

Which is Faster?

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


Joined: 15 Mar 2005
Posts: 8
Topics: 4

PostPosted: Tue Jul 19, 2005 9:42 am    Post subject: Which is Faster? Reply with quote

Under DB2, is one of the below faster than the other?

1) FIELD NOT IN (" ")

2) FIELD NOT = " "

3) (FIELD > " " OR FIELD < " ")

I was told in the past that number 3 was faster than number 1 and 2.
I think the reason that I was given was that by using the NOT command, all of the records would have to be checked in order to determine if the condition was true, whereas using the < > commands, the record reading would stop once the condition was found to be true.

Thanks...
Back to top
View user's profile Send private message
schintala
Beginner


Joined: 18 May 2005
Posts: 108
Topics: 31
Location: USA

PostPosted: Tue Jul 19, 2005 9:59 am    Post subject: Reply with quote

These are three different conditions. We can't judge which one gives optimized result. By thumb rule it is true that using greater or lesser than symbols definitely gives more optimized than "between" clause. I would run explain on SQL statement to know better use of these expressions.
Back to top
View user's profile Send private message
hisabarish
Beginner


Joined: 21 Jun 2005
Posts: 38
Topics: 11

PostPosted: Wed Jul 20, 2005 1:08 am    Post subject: Reply with quote

Exactly, the no.3 is faster than 1,2. Because db2 takes the binary comparison ( ie., Binary search logic ). But the numbers 1 and 2 are first search the result and compare it.

other wise use the query in the explain command.. u will see the better result in Plan_table.
_________________
Sabari
Madras
Back to top
View user's profile Send private message
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