Formatting code for OracleSQLTuning


show source only

{{parent page="Oracle''}}

===SQL Tuning in Oracle===

Explain plan
%%
explain plan
set statement_id = 'some_name'
for
select xxx from yyy;
Explained.
%%

Unfortunately, the plan is not visible on EM. One can get a text output by querying the plan_table:
%%(SQL)
BEGIN
:stid := 'some_name';
END;
/

SELECT rtrim(substr(LPAD(' ',2*(LEVEL-1))||operation,1,30))||' '
||rtrim(options)||' '||rtrim(object_name)|| ' '
||'(cost= '||cost||', cardinality='||
"Query Plan"
FROM plan_table
START WITH id = 0
AND upper(statement_id) = upper(:stid)
CONNECT BY PRIOR id = parent_id AND upper(statement_id) = upper(:stid);
%%
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki