When Oracle replaced the
sort_area_size and hash_area_size functionality with the
pga_aggregate_target parameter in Oracle9i, there was a great deal
of speculation about how to control sorting and hash joins within the
large PGA region. Here we discuss two issues. How do we
increase the RAM for hash joins and RAM sorting within the
pga_aggregate_target?
For example, we might have
a single evening batch task that would benefit from using all of the
pga_aggregate_target, not just the 5% limit.
Increasing Hash
Joins
To force hash joins you
must perform two steps. It may not be enough to increase the
hash_area_size if the CBO is stubborn, and usually you must force the
hash join with a hint.
Step 1 - Increase the hash_area_size maximum
alter session set
workarea_size_policy=manual;
alter session set hash_area_size=1048576000;
Step 2 - Add a use_hash hint to the SQL
select /*+ use_hash(a,
b)*/
from . . .
Increasing RAM sorting
In Oracle9i, the sorting
default is that no single task may consume more than 5% of the
pga_aggregate_target region before the sort pages-out to the TEMP
tablespace for a disk sort. For parallel sorts, the limit is 30%
of the PGA aggregate, regardless of the number of parallel processes.
You can override the
default sorting behavior in two ways:
Option 1 - Manual
override:
alter session set
workarea_size_policy=manual;
alter session set sort_area_size=1048576000;
Option 2 - Bounce
with special hidden parameter: In this example, we increase the
default amount of RAM available to sort operations from 5% to about 50%:
pga_aggregate_target=10g
_smm_max_size=4000000;
Not that the number for _smm_max_size is expressed in k-bytes, so this
value is about 4.5 gigabytes.
Remember, hidden parameters are totally unsupported, so use this
technique at your own risk.
|
|
Need an Oracle Health Check?
- Do you have
bad performance after an upgrade?
- Need to
certify that your database follows best practices?
BC Oracle performance gurus can quickly
certify every aspect of your
Oracle database and provide a complete verification that your database
is fully optimized. |

|