Skip to content
Home » Oracle Database » Performance » SQL Tuning » When Loop Getting Slower Than Ever

When Loop Getting Slower Than Ever

We found a SQL statement in a loop is very slower than ever, so we performed a SQL tuning for the SQL to check any unusual events, but the result shows that the execution plan looks optimized and unchanged.

It seems to be a dead end. But how about the data? Any special data involved?

Eventually, there're some NULL values in the result set hit the loop's performance. In some cases, NULL values prevent following statements in the loop from using matched indexes. Furthermore, the result may not be accurate.

To remove NULL values, we use EXISTS condition in WHERE clause to exclude them from the result set.

Leave a Reply

Your email address will not be published. Required fields are marked *