浅析PGA

来源:互联网 发布:淘宝购物车营销啥意思 编辑:程序博客网 时间:2024/05/17 22:25
作用:
会话数据排序(sort, hash_join, group-by, bitmap merge and bitmap index create)(不够就去temp space);会话权限审核,可以快速读取权限保存;绑定变量;游标区

构成:

主要由三个相关区域组成:
private SQL area:holds information about a parsed SQL statement and other session-specific information for processing
session Memory:hold a session's variables(logon information) and other information related to the session
SQL Work Areas:A work area is a private allocation of PGA memory used for memory-intensive operations

PGA管理
手动管理和自动管理,但是推荐使用自动管理方式,这样可以避免我们在手动配置时对数据库的不了解,造成对值得各个参数设置不标准

重要参数:
PGA_AGGREGATE_TARGET:所有session一共使用的最大PGA上限
在OLTP系统中,典型PGA内存设置应该是总内存的较小部分(20%),剩下的80%分配给SGA
在DSS系统中,由于会运行一些很大的查询,典型的PGA内存最多分配70%的内存
select namevalue/1024/1024 MB from v$parameter where name ='pga_aggregate_target';
_pga_max_size(隐藏参数):每个session只能用到一半_pga_max_size值大小的内存

统计命中率
select pga_target_for_estimate/1024/1024 ||'M' "Estimate PGA Target",estd_pga_cache_hit_percentage "Cache Hit(%)",estd_extra_bytes_rw/1024/1024 ||'M' "Extra Read/Write",estd_overalloc_account "Over alloc count" 
from v$pga_target_adivce;

查看当前数据库SQL连接
select spid,program,pga_max_mem,pga_alloc_mem,pga_used_mem,pga_freeable_mem from v$process where program like '%orcl%';

查看PGA各个区域使用情况
select p.program,p.spid,pm.category,pm.allocated,pm.used,pm.max_allocated 
from v$process p,v$process_memory pm 
where p.pid=pm.pid
and p.spid in (select spid from v$process where addr in 
(select paddr from v$session where sid in
(select distinct sid from v$mystat)
));
0 0
原创粉丝点击