浅析PGA

本文深入探讨了数据库中PGA内存管理的关键概念,包括其构成、如何通过重要参数进行配置,以及如何查看和优化PGA内存使用情况,旨在帮助数据库管理员更高效地管理资源。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

作用:
会话数据排序(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)
));
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值