-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: performance of selects with in elements statements
PostPosted: Thu Nov 10, 2005 7:12 pm 
Beginner
Beginner

Joined: Thu Feb 03, 2005 10:42 pm
Posts: 30
I have a situation where because of some business requirement i often filter queries using an in statement that checks to see if a value is in a group of elements.
That group of elements is fairly small; between 2-10. So I was wondering if it is more efficient to do a
and (value = ? or value = ? or value = ?)
rather than
and value in elements(?)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 10, 2005 8:11 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
if you check elements in database EXISTS is better than IN, but if you do it in java i think that isn't important - compiler will optimize it


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 10, 2005 8:51 pm 
Beginner
Beginner

Joined: Thu Feb 03, 2005 10:42 pm
Posts: 30
snpesnpe wrote:
if you check elements in database EXISTS is better than IN, but if you do it in java i think that isn't important - compiler will optimize it


well that was what I was hoping, if it auto optimizes it it makes my life easy


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


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

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.