Tuning Scalar Subquery with Rewrite
The following SQL is a good example of scalar sub query tuning. The original query takes few hours to run. Please see the query and the plan below. SELECT SUM (FEE_PAID), MAX (INVOICE_DATE) FROM (SELECT STH.DATE_OF_TRAN AS INVOICE_DATE,STH.PENDING_SEQ_NO AS PENDING_TRAN_NUMBER, (SELECT FEE_AMT FROM FEE_TAB FT1 WHERE T_SEQ_NO = (SELECT MAX (T_SEQ_NO) FROM FEE_TAB FT2 WHERE P_SEQ_NO […]