日期:2014-05-16  浏览次数:20545 次

最近oracle使用总结

1:查看sql的执行计划

explain plan for sql

然后执行select * from table(dbms_xplan.display());

例如

explain plan for select rownum no,id,name from product_group order by name

然后执行select * from table(dbms_xplan.display());

输出为

?
-----------------------------------
| Id? | Operation??????????? |? Name????????? | Rows? | Bytes | Cost? |
-----------------------------------
|?? 0 | SELECT STATEMENT???? |??????????????? |?????? |?????? |?????? |
|?? 1 |? SORT ORDER BY?????? |??????????????? |?????? |?????? |?????? |
|?? 2 |?? COUNT????????????? |??????????????? |?????? |?????? |?????? |
|?? 3 |??? TABLE ACCESS FULL | PRODUCT_GROUP? |?????? |?????? |?????? |
-----------------------------------
?
Note: rule based optimization