X

Carlos Orozco's Blog

TEMP use and spilling to disk

Carlos Orozco
Master Principal Sales Engineer

I've run across this recently. I think in this case, a batch process need more memory that was allotted by the auto work area size policy.

This is the issue we saw, lots of direct read and writes to temp.
Slow

SQL>alter session set workarea_size_policy=manual;

SQL>alter session set workarea_size_policy=manual;

SQL> alter session set hash_area_size=1073741824;

after changing the work area size policy to manual and giving a large amount a ram to sort we then saw all the direct reads and writes to temp disappear.
Slow

I think there may be times when measures like this are needed. Anyone else run across a case like this?

Join the discussion

Comments ( 2 )
  • Dominic Brooks Thursday, March 27, 2014

    Setting manual workarea sizes is definitely a valid option if you need significant memory for these.

    But step 1 should be to look at the accuracy of the optimizer's row estimates compared to the actual rowsource metrics for such operations

    Problematic temp space usage happens most often when automatic workareas are poorly sized due to these estimates which are significantly inaccurate (too few rows estimated compared to actuals).

    Real-Time SQL Monitoring can help diagnose.


  • guest Thursday, March 27, 2014

    Thanks Dominic, it actually it did occur to me to look at the cardinality estimates. In this case there was a complex inline view. I think the optimizer had a bit of a time with making a good estimate.


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.