Hi
I'm wondering what is supposed to be more performant between an EXISTS or an IN because I always receive different performance results.
Maybe someone can tell me which on is IN GENERAL more performant.
Example :
IN :
----
SELECT
count(distinct DBA.fac_ind_opts.ind_key)
FROM
DBA.fac_ind_opts
WHERE
DBA.fac_ind_opts.ind_key IN (SELECT A.ind_key
FROM DBA.fac_ind_opts A,
DBA.dim_opts B,
DBA.dim_individual C
WHERE A.opts_key = B.opts_key
AND A.ind_key=C.ind_key
)
EXISTS :
--------
SELECT
count(distinct DBA.fac_ind_opts.ind_key)
FROM
DBA.fac_ind_opts
WHERE
EXISTS (SELECT 1
FROM DBA.fac_ind_opts A,
DBA.dim_opts B,
DBA.dim_individual C
WHERE A.opts_key = B.opts_key
AND A.ind_key=C.ind_key
AND DBA.fac_ind_opts.ind_key = A.ind_key
)
Thanx for help
I'm wondering what is supposed to be more performant between an EXISTS or an IN because I always receive different performance results.
Maybe someone can tell me which on is IN GENERAL more performant.
Example :
IN :
----
SELECT
count(distinct DBA.fac_ind_opts.ind_key)
FROM
DBA.fac_ind_opts
WHERE
DBA.fac_ind_opts.ind_key IN (SELECT A.ind_key
FROM DBA.fac_ind_opts A,
DBA.dim_opts B,
DBA.dim_individual C
WHERE A.opts_key = B.opts_key
AND A.ind_key=C.ind_key
)
EXISTS :
--------
SELECT
count(distinct DBA.fac_ind_opts.ind_key)
FROM
DBA.fac_ind_opts
WHERE
EXISTS (SELECT 1
FROM DBA.fac_ind_opts A,
DBA.dim_opts B,
DBA.dim_individual C
WHERE A.opts_key = B.opts_key
AND A.ind_key=C.ind_key
AND DBA.fac_ind_opts.ind_key = A.ind_key
)
Thanx for help