Whey sometimes using Exists Function is better [message #301441] |
Wed, 20 February 2008 11:41 |
epall
Messages: 3 Registered: February 2008 Location: KL
|
Junior Member |
|
|
Hi guys,
I am really wondering why the cost for query B is better than query A.
-----Query B---
select NAME
,WEEK_KEY as WEEK_KEY
,count(1) as TOTAL_RECORD
from SRC_CUST_INFO src
where RECORD_TYPE_ID ='PAS'
and AGE > 30
group by WEEK_KEY
-----Query B---
select NAME
,WEEK_KEY as WEEK_KEY
,count(1) as TOTAL_RECORD
from SRC_CUST_INFO src
where exists ( select null from LOOKUP_CUST_MOB where ID = 'PAS')
and AGE > 30
group by WEEK_KEY
--------------------------------------------
Welcome & thank you very much for donating your idea!
|
|
|
|
|
|
|
|
|
|