Sunday, 10 May 2015

SQL: IN Vs EXIST in oracle SQL (Performance)

IN operator:
-----------------
 1. IN operator reads the all the records from the inner table.

EXIST
------------
1. EXIST does not read all the records from the inner table.

IN -  reads all the columns in the rows returned by the inner query
EXIST - just checks for the availability of rows returned by the inner query

Hence, if we don't need the data from the inner table then best choice is the EXIST operator , as it boosts the performance.


Similarly, count(0) is a performance booster over count(*)

No comments:

Post a Comment