SQL Plan Comparison

The plan of an SQL can change, and the change is justified if it doesn’t degrade performance. Changes in the values of bind variables,  change in statistics etc. can change the plan which is often an expected behavior. But now and then you may see a change that degrades performance. Below script compares the plans for  SQL s from […]

What is Tuning?

In the context of database processing, tuning can be defined as a set of techniques that helps the database to operate more efficiently–with higher throughput. Database tuning can be at the SQL statement level, or at the system level. SQL Tuning SQL Tuning is a set of techniques used to execute the SQL in the […]

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 […]