{"id":5364,"date":"2024-11-14T13:21:45","date_gmt":"2024-11-14T05:21:45","guid":{"rendered":"https:\/\/fwq.ai\/blog\/5364\/"},"modified":"2024-11-14T13:21:45","modified_gmt":"2024-11-14T05:21:45","slug":"oracle%e8%a7%a3%e9%87%8a%e8%ae%a1%e5%88%92%e6%80%8e%e4%b9%88%e7%9c%8b","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/5364\/","title":{"rendered":"oracle\u89e3\u91ca\u8ba1\u5212\u600e\u4e48\u770b"},"content":{"rendered":"<blockquote><p>\n  oracle \u89e3\u91ca\u8ba1\u5212\u662f\u5bf9 sql \u8bed\u53e5\u6267\u884c\u8fc7\u7a0b\u7684\u8be6\u7ec6\u63cf\u8ff0\u3002\u8981\u83b7\u53d6\u89e3\u91ca\u8ba1\u5212\uff0c\u4f7f\u7528 explain plan \u547d\u4ee4\u3002\u89e3\u91ca\u8ba1\u5212\u663e\u793a\u4e00\u7cfb\u5217\u64cd\u4f5c\uff0c\u6bcf\u4e2a\u64cd\u4f5c\u5305\u542b\u64cd\u4f5c\u7c7b\u578b\u3001\u5bf9\u8c61\u540d\u79f0\u3001\u5904\u7406\u7684\u884c\u6570\u548c\u5b57\u8282\u6570\u4ee5\u53ca\u6210\u672c\u3002table access full\u3001index range scan \u548c nested loops \u7b49\u64cd\u4f5c\u663e\u793a\u4e86\u67e5\u8be2\u5982\u4f55\u6267\u884c\u3002\u6210\u672c\u5b57\u6bb5\u53ef\u8bc6\u522b\u6027\u80fd\u74f6\u9888\uff0c\u4f18\u5316\u63aa\u65bd\uff08\u5982\u521b\u5efa\u7d22\u5f15\u6216\u8c03\u6574\u8c13\u8bcd\uff09\u53ef\u89e3\u51b3\u8fd9\u4e9b\u74f6\u9888\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/26\/2024052620220531986.jpg\" class=\"aligncenter\" title=\"oracle\u89e3\u91ca\u8ba1\u5212\u600e\u4e48\u770b\u63d2\u56fe\" alt=\"oracle\u89e3\u91ca\u8ba1\u5212\u600e\u4e48\u770b\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u89e3\u8bfb Oracle \u89e3\u91ca\u8ba1\u5212<\/strong><\/p>\n<p>Oracle \u89e3\u91ca\u8ba1\u5212\u662f\u6570\u636e\u5e93\u63d0\u4f9b\u7684\u5173\u4e8e SQL \u8bed\u53e5\u6267\u884c\u8ba1\u5212\u7684\u4fe1\u606f\u3002\u5b83\u63d0\u4f9b\u4e86\u5bf9\u8bed\u53e5\u5982\u4f55\u6267\u884c\u4ee5\u53ca\u4e3a\u4ec0\u4e48\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u6267\u884c\u7684\u6df1\u5165\u89c1\u89e3\u3002\u4e86\u89e3\u5982\u4f55\u89e3\u8bfb\u89e3\u91ca\u8ba1\u5212\u5bf9\u4e8e\u4f18\u5316\u67e5\u8be2\u6027\u80fd\u81f3\u5173\u91cd\u8981\u3002<\/p>\n<p><strong>\u6b65\u9aa4 1\uff1a\u83b7\u53d6\u89e3\u91ca\u8ba1\u5212<\/strong><\/p>\n<p>\u8981\u83b7\u53d6\u89e3\u91ca\u8ba1\u5212\uff0c\u53ef\u4ee5\u4f7f\u7528 EXPLAIN PLAN \u547d\u4ee4\uff1a<\/p>\n<pre>EXPLAIN PLAN FOR &lt;SQL statement&gt;;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6b65\u9aa4 2\uff1a\u7406\u89e3\u8ba1\u5212\u7ed3\u6784<\/strong><\/p>\n<p>\u89e3\u91ca\u8ba1\u5212\u7531\u4e00\u7cfb\u5217\u884c\u7ec4\u6210\uff0c\u6bcf\u884c\u4ee3\u8868\u67e5\u8be2\u6267\u884c\u4e2d\u7684\u4e00\u4e2a\u64cd\u4f5c\u3002\u8ba1\u5212\u6811\u4ece\u4e0a\u5230\u4e0b\u5448\u73b0\uff0c\u6839\u8282\u70b9\u8868\u793a\u67e5\u8be2\u7684\u4e3b\u8981\u64cd\u4f5c\u3002<\/p>\n<p><strong>\u6b65\u9aa4 3\uff1a\u5173\u952e\u5b57\u6bb5<\/strong><\/p>\n<p>\u6bcf\u4e2a\u8ba1\u5212\u884c\u5305\u542b\u4ee5\u4e0b\u5173\u952e\u5b57\u6bb5\uff1a<\/p>\n<ul>\n<li> <strong>Operation\uff1a<\/strong>\u64cd\u4f5c\u7c7b\u578b\uff0c\u5982 TABLE ACCESS FULL\u3001INDEX RANGE SCAN<\/li>\n<li> <strong>Object Name\uff1a<\/strong>\u53c2\u4e0e\u64cd\u4f5c\u7684\u5bf9\u8c61\u7684\u540d\u79f0\uff0c\u5982\u8868\u6216\u7d22\u5f15<\/li>\n<li> <strong>Rows\uff1a<\/strong>\u4f30\u8ba1\u5728\u6b64\u64cd\u4f5c\u4e2d\u5904\u7406\u7684\u884c\u6570<\/li>\n<li> <strong>Bytes\uff1a<\/strong>\u4f30\u8ba1\u5728\u6b64\u64cd\u4f5c\u4e2d\u5904\u7406\u7684\u5b57\u8282\u6570<\/li>\n<li> <strong>Cost\uff1a<\/strong>\u64cd\u4f5c\u7684\u4f30\u8ba1\u6210\u672c<\/li>\n<\/ul>\n<p><strong>\u6b65\u9aa4 4\uff1a\u89e3\u8bfb\u64cd\u4f5c<\/strong><\/p>\n<p>\u7406\u89e3\u6bcf\u79cd\u64cd\u4f5c\u7684\u542b\u4e49\u81f3\u5173\u91cd\u8981\uff1a<\/p>\n<ul>\n<li> <strong>TABLE ACCESS FULL\uff1a<\/strong>\u4ece\u8868\u4e2d\u626b\u63cf\u6240\u6709\u884c\u3002<\/li>\n<li> <strong>INDEX RANGE SCAN\uff1a<\/strong>\u4f7f\u7528\u7d22\u5f15\u626b\u63cf\u8868\u7684\u5b50\u96c6\u3002<\/li>\n<li> <strong>NESTED LOOPS\uff1a<\/strong>\u9010\u884c\u68c0\u67e5\u4e24\u4e2a\u8868\u3002<\/li>\n<li> <strong>CARTESIAN PRODUCT\uff1a<\/strong>\u5bf9\u4e24\u4e2a\u8868\u4e2d\u7684\u6240\u6709\u884c\u8fdb\u884c\u5339\u914d\u3002<\/li>\n<\/ul>\n<p><strong>\u6b65\u9aa4 5\uff1a\u8bc6\u522b\u6027\u80fd\u74f6\u9888<\/strong><\/p>\n<p>\u6210\u672c\u5b57\u6bb5\u662f\u8bc6\u522b\u6027\u80fd\u74f6\u9888\u7684\u5173\u952e\u3002\u9ad8\u6210\u672c\u7684\u64cd\u4f5c\u8868\u660e\u9700\u8981\u4f18\u5316\u3002<\/p>\n<p><strong>\u6b65\u9aa4 6\uff1a\u4f18\u5316\u67e5\u8be2<\/strong><\/p>\n<p>\u4e00\u65e6\u8bc6\u522b\u51fa\u6027\u80fd\u74f6\u9888\uff0c\u5c31\u53ef\u4ee5\u901a\u8fc7\u4f18\u5316\u67e5\u8be2\u6765\u89e3\u51b3\u95ee\u9898\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u521b\u5efa\u6216\u91cd\u65b0\u6784\u5efa\u7d22\u5f15\u3001\u8c03\u6574\u67e5\u8be2\u8c13\u8bcd\u6216\u4f7f\u7528\u4e0d\u540c\u7684\u8fde\u63a5\u7c7b\u578b\u3002<\/p>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<p>\u8003\u8651\u4e00\u4e2a\u5305\u542b\u4ee5\u4e0b\u89e3\u91ca\u8ba1\u5212\u7684\u67e5\u8be2\uff1a<\/p>\n<pre>Operation     | Object Name | Rows  | Bytes | Cost\n--------------------------------------------------------\nTABLE ACCESS FULL  | t1        | 10000 | 50000 | 10\nINDEX RANGE SCAN | t2        | 100   | 1000  | 2\nNESTED LOOPS     |           | 10    | 100   | 1<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8be5\u8ba1\u5212\u8868\u660e\uff0c\u4ece\u8868 t1 \u4e2d\u626b\u63cf\u6240\u6709\u884c (TABLE ACCESS FULL) \u662f\u6700\u6602\u8d35\u7684\u64cd\u4f5c\u3002\u901a\u8fc7\u521b\u5efa t1 \u4e0a\u7684\u7d22\u5f15\u6765\u4f18\u5316\u67e5\u8be2\uff0c\u53ef\u4ee5\u51cf\u5c11\u6210\u672c\u5e76\u63d0\u9ad8\u6027\u80fd\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u89e3\u91ca\u8ba1\u5212\u600e\u4e48\u770b\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>oracle \u89e3\u91ca\u8ba1\u5212\u662f\u5bf9 sql \u8bed\u53e5\u6267\u884c\u8fc7\u7a0b\u7684\u8be6\u7ec6\u63cf\u8ff0\u3002\u8981\u83b7\u53d6\u89e3\u91ca\u8ba1\u5212\uff0c\u4f7f\u7528 explain plan \u547d\u4ee4\u3002\u89e3\u91ca\u8ba1\u5212\u663e\u793a\u4e00\u7cfb\u5217\u64cd\u4f5c\uff0c\u6bcf\u4e2a\u64cd\u4f5c\u5305\u542b\u64cd\u4f5c\u7c7b\u578b\u3001\u5bf9\u8c61\u540d\u79f0\u3001\u5904\u7406\u7684\u884c\u6570\u548c\u5b57\u8282\u6570\u4ee5\u53ca\u6210\u672c\u3002table access full\u3001index range scan \u548c nested loops \u7b49\u64cd\u4f5c\u663e\u793a\u4e86\u67e5\u8be2\u5982\u4f55\u6267\u884c\u3002\u6210\u672c\u5b57\u6bb5\u53ef\u8bc6\u522b\u6027\u80fd\u74f6\u9888\uff0c\u4f18\u5316\u63aa\u65bd\uff08\u5982\u521b\u5efa\u7d22\u5f15\u6216\u8c03\u6574\u8c13\u8bcd\uff09\u53ef\u89e3\u51b3\u8fd9\u4e9b\u74f6\u9888\u3002 \u5982\u4f55\u89e3\u8bfb Oracle \u89e3\u91ca\u8ba1\u5212 Oracle \u89e3\u91ca\u8ba1\u5212\u662f\u6570\u636e\u5e93\u63d0\u4f9b\u7684\u5173\u4e8e SQL \u8bed\u53e5\u6267\u884c\u8ba1\u5212\u7684\u4fe1\u606f\u3002\u5b83\u63d0\u4f9b\u4e86\u5bf9\u8bed\u53e5\u5982\u4f55\u6267\u884c\u4ee5\u53ca\u4e3a\u4ec0\u4e48\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u6267\u884c\u7684\u6df1\u5165\u89c1\u89e3\u3002\u4e86\u89e3\u5982\u4f55\u89e3\u8bfb\u89e3\u91ca\u8ba1\u5212\u5bf9\u4e8e\u4f18\u5316\u67e5\u8be2\u6027\u80fd\u81f3\u5173\u91cd\u8981\u3002 \u6b65\u9aa4 1\uff1a\u83b7\u53d6\u89e3\u91ca\u8ba1\u5212 \u8981\u83b7\u53d6\u89e3\u91ca\u8ba1\u5212\uff0c\u53ef\u4ee5\u4f7f\u7528 EXPLAIN PLAN \u547d\u4ee4\uff1a EXPLAIN PLAN FOR &lt;SQL statement&gt;; \u767b\u5f55\u540e\u590d\u5236 \u6b65\u9aa4 2\uff1a\u7406\u89e3\u8ba1\u5212\u7ed3\u6784 \u89e3\u91ca\u8ba1\u5212\u7531\u4e00\u7cfb\u5217\u884c\u7ec4\u6210\uff0c\u6bcf\u884c\u4ee3\u8868\u67e5\u8be2\u6267\u884c\u4e2d\u7684\u4e00\u4e2a\u64cd\u4f5c\u3002\u8ba1\u5212\u6811\u4ece\u4e0a\u5230\u4e0b\u5448\u73b0\uff0c\u6839\u8282\u70b9\u8868\u793a\u67e5\u8be2\u7684\u4e3b\u8981\u64cd\u4f5c\u3002 \u6b65\u9aa4 3\uff1a\u5173\u952e\u5b57\u6bb5 \u6bcf\u4e2a\u8ba1\u5212\u884c\u5305\u542b\u4ee5\u4e0b\u5173\u952e\u5b57\u6bb5\uff1a Operation\uff1a\u64cd\u4f5c\u7c7b\u578b\uff0c\u5982 TABLE ACCESS FULL\u3001INDEX RANGE SCAN Object Name\uff1a\u53c2\u4e0e\u64cd\u4f5c\u7684\u5bf9\u8c61\u7684\u540d\u79f0\uff0c\u5982\u8868\u6216\u7d22\u5f15 Rows\uff1a\u4f30\u8ba1\u5728\u6b64\u64cd\u4f5c\u4e2d\u5904\u7406\u7684\u884c\u6570 Bytes\uff1a\u4f30\u8ba1\u5728\u6b64\u64cd\u4f5c\u4e2d\u5904\u7406\u7684\u5b57\u8282\u6570 Cost\uff1a\u64cd\u4f5c\u7684\u4f30\u8ba1\u6210\u672c \u6b65\u9aa4 4\uff1a\u89e3\u8bfb\u64cd\u4f5c \u7406\u89e3\u6bcf\u79cd\u64cd\u4f5c\u7684\u542b\u4e49\u81f3\u5173\u91cd\u8981\uff1a TABLE [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-5364","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5364","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=5364"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5364\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=5364"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=5364"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=5364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}