Tutorial66.com
@Share Application Development Skill.



Tutorial is tutorial...66 is My Country Code Up to 10 Years EXP for Application Development Role in Thailand.
collapse

Tutorial Category



Topic: Use EXISTS Instead of IN in SQL query WHERE Condition for good performance  (Read 165 times)


My Development skill
Java JSP Servlet EJB
Spring Framework
Hibernate Framework
iReport Jasper Report
Apache CXF
PHP Codigniter
Oracle PLSQL
Unix Shell Script
if your query performance drop when use IN  in sql query command .
try to use EXISTS instead of IN for better query performance

for example

Use this code for best performance
Code: [Select]
select  * from my_table where
exists (select 1 from dual where my_field in (1,2,3,4,5,6,7,8,9,10) )

instead of
Code: [Select]
select  * from my_table where
my_field in (1,2,3,4,5,6,7,8,9,10)





SimplePortal 2.3.3 © 2008-2010, SimplePortal