Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to set sort_area_size

650105Jul 9 2009 — edited Jul 9 2009
hello
I’m dealing with a query in which almost 100 inner joins involved. I will post query if needed. Basically it is insert statement but I run only it selection part it take 40 minutes. When I run ASH REPORT during execution I found direct path read temp, direct path write temp in top user event , buffer busy waits, control file sequential read,. I’m using 11g with automatic memory management 9Gb assign to memeory_target, and memeory_max_target,. My workarea_size_policy is auto and sort_area_size
is default 64k. all sory take palce in temp almost 10 to 15 GB temp use when I executes this select statement. I know it is very difficult to sorry all in memory but it should not done all in temp. I wanted to change workarea_size_policyto manual and set sort_area_size. What would be the size of sort_area_size ? I was reading a BOOK of Jonathan Lewis COST based oracle fundamental in which he told us the way to sizing the sort_area_size. But he did not show how he calculated this size and he did only for one table in my case five table join with one table. How I calculate size

Here is John Example
After using the dbms_stats.gather_table_stats procedure, I can check view user_tables
to confirm that the table fills 2,753 blocks, and holds 1,048,576 rows with an avg_row_len of
14 bytes, and that the avg_col_len for column sortcode is 7 bytes (the v2, v3 columns are there
simply to avoid the possibility of some funny boundary conditions appearing). These 7 bytes
include the 1 byte that holds the column length itself, so we can work out that the total volume
of data sorted must be 6MB, and that my memory allocation of 1MB is not going to be sufficient
for an in-memory (optimal) sort.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 6 2009
Added on Jul 9 2009
2 comments
2,216 views