比较高的Parses和Hard parses如何降低,新手求帮忙~

[复制链接]
查看11 | 回复6 | 2015-3-20 10:13:49 | 显示全部楼层 |阅读模式
从AWR中看到Parses和Hard parses每秒的量都挺大的
Execute to Parse %参数也很低。
请教各位大神,怎么来降低Hard Parse,都有些啥方法?
谢谢~~


附上AWR
回复

使用道具 举报

千问 | 2015-3-20 10:13:49 | 显示全部楼层
硬解析太多是没有使用绑定变量。
才30-40个并发用户,你的机很轻松了。不过有两条SQL一致性读太多,优化即可。
select sb.brandname, sb.id, tt.cnt from sw_brand sb join (select sp.brandid, count(1) as cnt from sw_products sp where sp.typeid in (select distinct id from sw_products_type start with id = 1 connect by prior id = pid) and sp.isonsale = 1 and sp.sdell = 0 group by sp.brandid) tt on sb.id = tt.brandid;
select * from (select p.id, p.productsid, p.productsname, p.pic from sw_products p where p.typeid in(select distinct id from sw_products_type start with id = 1 connect by prior id = pid) and p.ISONSALE=1 and p.SDELL=0 order by p.id desc) where rownumshow parameter sga
NAME
TYPEVALUE
------------------------------------ ----------- -------
lock_sga
boolean FALSE
pre_page_sga
boolean FALSE
sga_max_size
big integer 2G
sga_target
big integer 2G
SQL> show parameter pga
NAME
TYPEVALUE
------------------------------------ ----------- -------
pga_aggregate_target
big integer 512M

SGA已经是2G了,buffer cache怎么调整~

回复

使用道具 举报

千问 | 2015-3-20 10:13:49 | 显示全部楼层
不愿糊涂 发表于 2012-9-27 15:49
SQL> show parameter sga
NAME
TYPEVALUE

将PGA+SGA内存设为3.2G,再设Buffer Cache为1.2G,其它为自动管理。空闲时重启数据库。
回复

使用道具 举报

千问 | 2015-3-20 10:13:49 | 显示全部楼层
阿吉2009 发表于 2012-9-27 16:04
将PGA+SGA内存设为3.2G,再设Buffer Cache为1.2G,其它为自动管理。空闲时重启数据库。

OK,我来试试
不过重启不能现在做

回复

使用道具 举报

千问 | 2015-3-20 10:13:49 | 显示全部楼层
这个需要看看
回复

使用道具 举报

千问 | 2015-3-20 10:13:49 | 显示全部楼层
阿吉2009 发表于 2012-9-27 14:41
硬解析太多是没有使用绑定变量。
才30-40个并发用户,你的机很轻松了。不过有两条SQL一致性读太多,优化即 ...

硬解析,使用绑定变量
这个该怎么来做呢?
那个语句并发较大这个没办法解决的。。。
回复

使用道具 举报

千问 | 2015-3-20 10:13:49 | 显示全部楼层
不愿糊涂 发表于 2012-9-27 16:52
硬解析,使用绑定变量
这个该怎么来做呢?

看语句在哪里的,在应用程序就修改应用程序,在DB就修改DB。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行