{"id":15655,"date":"2023-12-04T21:32:10","date_gmt":"2023-12-04T13:32:10","guid":{"rendered":"https:\/\/wx.kaifamiao.info\/?p=15655"},"modified":"2023-12-04T21:34:32","modified_gmt":"2023-12-04T13:34:32","slug":"oracle-zhong-ru-he-sheng-cheng-explain-plan","status":"publish","type":"post","link":"http:\/\/wx.kaifamiao.info\/index.php\/2023\/12\/04\/oracle-zhong-ru-he-sheng-cheng-explain-plan\/","title":{"rendered":"Oracle \u4e2d\u5982\u4f55\u751f\u6210 explain plan\uff1f"},"content":{"rendered":"<p>\u8981\u751f\u6210 SQL \u67e5\u8be2\u7684\u6267\u884c\u8ba1\u5212\uff08Explain Plan\uff09\u5728 Oracle \u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5\uff1a<\/p>\n<ol>\n<li><strong>\u4f7f\u7528 SQL Developer \u6216 SQL*Plus\uff1a<\/strong>\n<ul>\n<li>\u5728 SQL Developer \u6216 SQL*Plus \u4e2d\uff0c\u53ef\u4ee5\u5728\u8981\u6267\u884c\u7684 SQL \u8bed\u53e5\u524d\u52a0\u4e0a <code>EXPLAIN PLAN FOR<\/code>\uff0c\u7136\u540e\u6267\u884c\u8fd9\u4e2a\u8bed\u53e5\u3002<\/li>\n<li>\u793a\u4f8b\uff1a<br \/>\n<code>sql<br \/>\nEXPLAIN PLAN FOR<br \/>\nSELECT * FROM your_table WHERE your_condition;<\/code><\/li>\n<li>\u6267\u884c\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528<code>SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);<\/code>\u6765\u67e5\u770b\u6267\u884c\u8ba1\u5212\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u4f7f\u7528 DBMS_XPLAN \u5305\uff1a<\/strong>\n<ul>\n<li>\u5982\u679c\u5df2\u7ecf\u6267\u884c\u4e86 SQL \u8bed\u53e5\uff0c\u53ef\u4ee5\u4f7f\u7528<code>DBMS_XPLAN.DISPLAY<\/code>\u8fc7\u7a0b\u6765\u663e\u793a\u6267\u884c\u8ba1\u5212\u3002\u9996\u5148\u8fd0\u884c\u67e5\u8be2\uff0c\u7136\u540e\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u663e\u793a\u8ba1\u5212\uff1a<br \/>\n<code>sql<br \/>\nSELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);<\/code><\/li>\n<li>\u8fd9\u5c06\u663e\u793a\u6700\u8fd1\u6267\u884c\u8fc7\u7684 SQL \u8bed\u53e5\u7684\u6267\u884c\u8ba1\u5212\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u4f7f\u7528 AUTOTRACE \u529f\u80fd\uff1a<\/strong>\n<ul>\n<li>\u5728 SQL Developer \u6216 SQL*Plus \u4e2d\uff0c\u4f7f\u7528 <code>SET AUTOTRACE ON<\/code> \u547d\u4ee4\uff0c\u7136\u540e\u6267\u884c\u67e5\u8be2\u3002\u8fd9\u5c06\u663e\u793a\u6267\u884c\u8ba1\u5212\u4ee5\u53ca\u67e5\u8be2\u7684\u7edf\u8ba1\u4fe1\u606f\u3002<\/li>\n<li>\u793a\u4f8b\uff1a<br \/>\n<code>sql<br \/>\nSET AUTOTRACE ON;<br \/>\nSELECT * FROM your_table WHERE your_condition;<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>\u4ee5\u4e0a\u65b9\u6cd5\u53ef\u4ee5\u5e2e\u52a9\u4f60\u751f\u6210\u5e76\u67e5\u770b SQL \u67e5\u8be2\u7684\u6267\u884c\u8ba1\u5212\uff0c\u8fd9\u4e9b\u6267\u884c\u8ba1\u5212\u5305\u542b\u4e86\u6570\u636e\u5e93\u5f15\u64ce\u6267\u884c\u67e5\u8be2\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u6709\u52a9\u4e8e\u4f18\u5316\u548c\u8c03\u6574\u67e5\u8be2\u6027\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8981\u751f\u6210 SQL \u67e5\u8be2\u7684\u6267\u884c\u8ba1\u5212\uff08Explain Plan\uff09\u5728 Oracle \u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5\uff1a \u4f7f\u7528 SQ [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[120],"tags":[],"class_list":["post-15655","post","type-post","status-publish","format-standard","hentry","category-oracel"],"_links":{"self":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/15655","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/comments?post=15655"}],"version-history":[{"count":1,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/15655\/revisions"}],"predecessor-version":[{"id":15656,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/15655\/revisions\/15656"}],"wp:attachment":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/media?parent=15655"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/categories?post=15655"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/tags?post=15655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}