接到AP管理人员反映,某系统登录很慢,需要几分钟:
關於XX測試機登錄慢的問題,我們去後臺發現如下SQL執行速度達到100多秒:
ORIGIN SQL:[portalSql.findNavAppList].
EXEC SQL:[
select distinct e.id,e.app_no,e.app_name_en,e.app_name_zh_tw,e.app_name_zh_cn,e.app_desc,e.default_page,e.app_seq
from pf_role_user b,pf_role c,pf_role_access d,pf_access_node a,pf_application e
where c.active_flag = '1' and a.active_flag = '1' and b.role_id = c.id and c.id = d.role_id
and b.user_id = :1 and d.access_node_id = a.id and a.app_id = e.id
order by e.app_seq
].
2011/06/15 17:15:31 [DEBUG] {SQLExecutorImpl:log} Execute SQL Statement is completed with the process time: 172190/ms,
打开网页,输入用户名密码,确实长时间无响应。
在确定了AP的HOSTNAME和登录使用的用户名后,查看V$session,找到相应的SID,查看v$session_wait,发现等待事件是db file scattered read,根据file#,block_id在dba_extents中查到是PF_ACCESS_NODE和PF_ROLE_USER
这两个表。检查发现,这两个表只有几千笔数据,但占用空间达到10几M。MOVE TABLE,REBUILD INDEX后,表只剩下几百K,索引也明显变小。再登录时发现速度已明显变快,大约3秒左右可以登入。再查看执行计划,5个表中4个全表扫描,统计信息陈旧,重新收集了五个表的统计信息后,登录速度加快到毫秒级,这条SQL的consistent gets从之前上万的减少到130.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10640532/viewspace-699992/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10640532/viewspace-699992/