Subject Performance in where subselect with not in clausula
Author Bayu
Hi all,

We have query like this...( on stored procedure )


Select distinct( base_nomor )
from My_Header
where
(
(
( revised_code = 'Y' )
or
( POSTED_CODE = 'C' )
)
and
( TANGGAL <= :BASIS_DATE )

/* <ad_condition> */

and base_nomor not in
(
Select distinct(base_nomor)
from My_header
where
(
( tanggal <= :BASIS_DATE )
and
( POSTED_CODE = 'P' )
and
( REFF_AKTIF_CODE = 'Y' )
)
)

/* </ad_condition> */


)

On the big database sub select which indicate in <ad_condition> and
</ad_condition>, will give me a bad performance.
How to improve performance on this query ?

Any advice are welcome

Thanks and regards
Bayu