--刪除上一個執行計劃
delete from plan_table where statement_id='testplan';
--執行計劃
explain plan set statement_id='testplan' for
select count(1) from tb_site_month
--查看執行計劃
select lpad('',5*(level-1))||operation operation,options,
object_name,cost,position
from plan_table
start with id=0 and statement_id='testplan'
connect by prior id=parent_id;
--查看執行計劃2
select
STATEMENT_ID "語句ID",
PLAN_ID "計劃ID",
TIMESTAMP "時間戳",
OPERATION "操作",
OPTIMIZER "優化器",
OBJECT_NAME "對象名稱",
OBJECT_TYPE "對象的類型(表、索引等)",
SEARCH_COLUMNS "搜索欄",
PARTITION_START "分區啓動",
PARTITION_STOP "分區停止",
PARTITION_ID "分區ID" ,
CPU_COST "CPU成本",
IO_COST "IO成本"
from plan_table
start with id=0 and statement_id='testplan'
connect by prior id=parent_id;