【TUNE_ORACLE】定製化執行計劃SQL參考

Attack_on_Jager發表於2021-08-04

實驗環境

搭建平臺:VMware Workstation

OS:RHEL 6.10

Grid&DB:Oracle 11.2.0.4


SQL參考

select case

         when access_predicates is not null or filter_predicates is not null then

          '*' || id

         else

          ' ' || id

       end as "Id",

       lpad(' ', level) || operation || ' ' || options "Operation",

       object_name "Name",

       cardinality "Rows",

       b.size_mb "Mb",

       case

         when object_type like '%TABLE%' then

          REGEXP_COUNT(a.projection, ']') || '/' || c.column_cnt

       end as "Column",

       access_predicates "Access",

       filter_predicates "Filter",

       case

         when object_type like '%TABLE%' then

          projection

       end as "Projection"

  from plan_table a,

       (select owner, segment_name, sum(bytes / 1024 / 1024) size_mb

          from dba_segments

         group by owner, segment_name) b,

       (select owner, table_name, count(*) column_cnt

          from dba_tab_cols

         group by owner, table_name) c

 where a.object_owner = b.owner(+)

   and a.object_name = b.segment_name(+)

   and a.object_owner = c.owner(+)

   and a.object_name = c.table_name(+)

 start with id = 0

connect by prior id = parent_id; 



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69992972/viewspace-2785124/,如需轉載,請註明出處,否則將追究法律責任。

相關文章