Wednesday, December 23, 2009

pga_aggregate_target

v$pga_target_advice - estd_pga_cache_hit_percentage
v$pgastat - maximum PGA allocated
dba_hist_pgastat

from doc

Setting PGA_AGGREGATE_TARGET to a nonzero value has the effect of automatically setting the WORKAREA_SIZE_POLICY parameter to AUTO. This means that SQL working areas used by memory-intensive SQL operators (such as sort, group-by, hash-join, bitmap merge, and bitmap create) will be automatically sized. A nonzero value for this parameter is the default since, unless you specify otherwise, Oracle sets it to 20% of the SGA or 10 MB, whichever is greater

init parameter

pga_aggregate_target

hidden parameters
_pga_max_size
_smm_px_max_size

Tuning - check the hit , firstpass and multipass
--eliminate overalloc and maximize cache hit
SELECT round (PGA_TARGET_FOR_ESTIMATE/1024/1024/1024) target_in_GB,
ESTD_PGA_CACHE_HIT_PERCENTAGE cache_hit_perc,
ESTD_OVERALLOC_COUNT
FROM v$pga_target_advice

SELECT    program,    pga_used_mem "PGA Used",    pga_alloc_mem "PGA Alloc",    pga_max_mem "PGA Max"   FROM v$process;

SELECT    low_optimal_size/1024 "Low (K)",    (high_optimal_size + 1)/1024 "High (K)",    optimal_executions "Optimal",    onepass_executions "1-Pass",    multipasses_executions ">1 Pass"   FROM v$sql_workarea_histogram  WHERE total_executions <> 0;

check multipass
SELECT    optimal_count "Optimal",    round(optimal_count * 100 / total,2) "Optimal %",    onepass_count "OnePass",    round(onepass_count * 100 / total,2) "Onepass %",    multipass_count "MultiPass",    round(multipass_count * 100 / total,2) "Multipass %"   FROM (       SELECT          DECODE (SUM(total_executions), 0, 1, SUM(total_executions)) total,          SUM(optimal_executions) optimal_count,          SUM(onepass_executions) onepass_count,          SUM(multipasses_executions) multipass_count         FROM v$sql_workarea_histogram -- Limits consideration of queries with LOW_OPTIMAL_SIZE limit <64k> 64*1024)

SELECT *   FROM (SELECT             workarea_address,             operation_type,             policy,             estimated_optimal_size           FROM v$sql_workarea       ORDER BY estimated_optimal_size)  WHERE ROWNUM <= 20;


ref-

it is important to remember that automatic PGA memory management via PGA_AGGREGATE_TARGET only applies to dedicated server connections. Memory allocation forshared server connections is still managed by SORT_AREA_SIZE, HASH_AREA_SIZE, and so forth



No comments: