代码拉取完成,页面将自动刷新
set pages 200
undef tab_owner
undef tab_name
WITH in_plan_objects AS
(
SELECT sql_id, object_name
FROM v$sql_plan
WHERE object_owner not in ('SYS','SYSTEM')
group by sql_id, object_name
)
,all_sql AS
(
SELECT sql_id
,sum(executions) execs
,round(sum(buffer_gets)/sum(executions)) bgetspx
FROM v$sql
WHERE executions >0
group by sql_id
)
select decode(object_name,null,'NO','YES') in_use
,i.table_owner||'.'||i.table_name tab_name
,p.sql_id sqlid
,s.execs execs
,least(s.bgetspx,999999) bgetspx
,decode(substr(index_name,1,3),'PK_',' '||i.owner||'.'||i.index_name,owner||'.'||index_name) iname
FROM dba_indexes i
,in_plan_objects p
,all_sql s
WHERE i.index_name = p.object_name (+)
and p.sql_id = s.sql_id (+)
and table_name = upper('&&tab_name')
and table_owner = nvl(upper('&&tab_owner'),'BOOKER')
order by in_use
,i.table_owner||'.'||i.table_name
,i.index_name
,s.execs
;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。