{"id":45115,"date":"2024-12-01T12:55:48","date_gmt":"2024-12-01T04:55:48","guid":{"rendered":"https:\/\/fwq.ai\/blog\/45115\/"},"modified":"2024-12-01T12:55:48","modified_gmt":"2024-12-01T04:55:48","slug":"mysql-block-nested-loop-join-bnl-%e7%ae%97%e6%b3%95%e4%b8%ad%ef%bc%8c%e4%b8%80%e6%ac%a1%e6%80%a7%e4%b8%8e-100-%e8%a1%8c%e6%95%b0%e6%8d%ae%e8%bf%9b%e8%a1%8c%e6%af%94%e8%be%83-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/45115\/","title":{"rendered":"MySQL Block Nested-Loop Join (BNL) \u7b97\u6cd5\u4e2d\uff0c\u201c\u4e00\u6b21\u6027\u4e0e 100 \u884c\u6570\u636e\u8fdb\u884c\u6bd4\u8f83\u201d\u662f\u5982\u4f55\u5b9e\u73b0\u7684\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>MySQL Block Nested-Loop Join (BNL) \u7b97\u6cd5\u4e2d\uff0c\u201c\u4e00\u6b21\u6027\u4e0e 100 \u884c\u6570\u636e\u8fdb\u884c\u6bd4\u8f83\u201d\u662f\u5982\u4f55\u5b9e\u73b0\u7684\uff1f<\/h1>\n<p>\u54c8\u55bd\uff01\u4eca\u5929\u5fc3\u8840\u6765\u6f6e\u7ed9\u5927\u5bb6\u5e26\u6765\u4e86\uff0c\u60f3\u5fc5\u5927\u5bb6\u5e94\u8be5\u5bf9\u90fd\u4e0d\u964c\u751f\u5427\uff0c\u90a3\u4e48\u9605\u8bfb\u672c\u6587\u5c31\u90fd\u4e0d\u4f1a\u5f88\u56f0\u96be\uff0c\u4ee5\u4e0b\u5185\u5bb9\u4e3b\u8981\u6d89\u53ca\u5230\uff0c\u82e5\u662f\u4f60\u6b63\u5728\u5b66\u4e60\uff0c\u5343\u4e07\u522b\u9519\u8fc7\u8fd9\u7bc7\u6587\u7ae0~\u5e0c\u671b\u80fd\u5e2e\u52a9\u5230\u4f60\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241106\/1730894447672b5a6f722e3.jpg\" class=\"aligncenter\" title=\"MySQL Block Nested-Loop Join (BNL) \u7b97\u6cd5\u4e2d\uff0c\u201c\u4e00\u6b21\u6027\u4e0e 100 \u884c\u6570\u636e\u8fdb\u884c\u6bd4\u8f83\u201d\u662f\u5982\u4f55\u5b9e\u73b0\u7684\uff1f\u63d2\u56fe\" alt=\"MySQL Block Nested-Loop Join (BNL) \u7b97\u6cd5\u4e2d\uff0c\u201c\u4e00\u6b21\u6027\u4e0e 100 \u884c\u6570\u636e\u8fdb\u884c\u6bd4\u8f83\u201d\u662f\u5982\u4f55\u5b9e\u73b0\u7684\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>MySQL Block Nested-Loop Join (BNL) \u7b97\u6cd5\u4f18\u5316<\/strong><\/p>\n<p>\u5bf9\u4e8e Block Nested-Loop Join (BNL) \u7b97\u6cd5\uff0c\u5176\u539f\u7406\u662f\u5c06\u5916\u5c42\u5faa\u73af\u7684\u884c\u7ed3\u679c\u96c6\u5b58\u50a8\u5728 Join Buffer \u4e2d\uff0c\u7136\u540e\u7528\u5185\u5c42\u8868\u7684\u6bcf\u4e00\u884c\u6570\u636e\u4e0e Join Buffer \u4e2d\u7684\u6240\u6709\u8bb0\u5f55\u8fdb\u884c\u6bd4\u8f83\u3002\u8fd9\u6837\u53ef\u4ee5\u51cf\u5c11\u5185\u5c42\u5faa\u73af\u7684\u626b\u63cf\u6b21\u6570\uff0c\u4ece\u800c\u4f18\u5316\u67e5\u8be2\u6027\u80fd\u3002<\/p>\n<p>\u4e3e\u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\uff0c\u5982\u679c\u5916\u5c42\u5faa\u73af\u7ed3\u679c\u96c6\u6709 1000 \u884c\u6570\u636e\uff0c\u4f7f\u7528 Nested-Loop Join (NLJ) \u7b97\u6cd5\u9700\u8981\u626b\u63cf\u5185\u5c42\u8868 1000 \u6b21\u3002\u4f46\u662f\uff0c\u5982\u679c\u4f7f\u7528 BNL \u7b97\u6cd5\uff0c\u6211\u4eec\u5148\u53d6\u51fa\u5916\u5c42\u8868\u7ed3\u679c\u96c6\u7684 100 \u884c\u5b58\u50a8\u5230 Join Buffer \u4e2d\u3002\u7136\u540e\uff0c\u7528\u5185\u5c42\u8868\u7684\u6bcf\u4e00\u884c\u6570\u636e\u53bb\u548c\u8fd9 100 \u884c\u7ed3\u679c\u96c6\u505a\u6bd4\u8f83\u3002\u8fd9\u6837\uff0c\u5185\u5c42\u8868\u53ea\u9700\u8981\u5faa\u73af 1000\/100 = 10 \u6b21\uff0c\u51cf\u5c11\u4e86 9\/10 \u7684\u626b\u63cf\u6b21\u6570\u3002<\/p>\n<p>\u7136\u800c\uff0c\u6709\u4eba\u63d0\u51fa\u4e86\u4e00\u4e2a\u95ee\u9898\uff1a\u201cJoin Buffer \u4e2d\u6709 10 \u884c\u6570\u636e\uff0c\u5185\u5c42\u8868\u7684\u6bcf\u4e00\u884c\u4e0e Join Buffer \u4e2d\u7684\u6570\u636e\u8fdb\u884c\u6bd4\u8f83\u3002\u6bd4\u8f83\u6b64\u65f6\u662f 10 x \u5185\u5c42\u8868\u7684\u884c\u6570\u3002\u4ec0\u4e48\u662f\u201c\u53ef\u4ee5\u4e00\u6b21\u6027\u4e0e 100 \u884c\u6570\u636e\u8fdb\u884c\u6bd4\u8f83\u201d\uff1f<\/p>\n<p>\u8981\u56de\u7b54\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u4eec\u9700\u8981\u4e86\u89e3 Simple Nested-Loop Join \u7b97\u6cd5\u7684\u7f3a\u70b9\u2014\u2014\u5185\u8868\u626b\u63cf\u6b21\u6570\u592a\u591a\u3002BNL \u7b97\u6cd5\u6539\u8fdb\u7684\u5730\u65b9\u5c31\u5728\u4e8e\u53ef\u4ee5\u51cf\u5c11\u5185\u8868\u7684\u626b\u63cf\u6b21\u6570\uff0c\u751a\u81f3\u53ef\u4ee5\u548c Hash Join \u7b97\u6cd5\u4e00\u6837\uff0c\u4ec5\u9700\u626b\u63cf\u5185\u8868\u4e00\u6b21\u3002<\/p>\n<p>Join Buffer \u7684\u4f5c\u7528\u662f\u7f13\u5b58\u6240\u6709\u53c2\u4e0e\u67e5\u8be2\u7684\u5217\uff0c\u800c\u4e0d\u662f\u53ea\u6709 Join \u7684\u5217\u3002\u8fd9\u4f7f\u5f97 BNL \u7b97\u6cd5\u53ef\u4ee5\u6279\u91cf\u6bd4\u8f83\uff0c\u5c31\u50cf\u793a\u4f8b\u4e2d\u6240\u8bf4\u7684\u201c\u4e00\u6b21\u6027\u4e0e 100 \u884c\u6570\u636e\u8fdb\u884c\u6bd4\u8f83\u201d\u4e00\u6837\u3002\u4e5f\u5c31\u662f\u8bf4\uff0cJoin Buffer \u5b58\u50a8\u4e86\u5916\u5c42\u8868\u7ed3\u679c\u96c6\u7684\u4e00\u90e8\u5206\uff0c\u5185\u5c42\u8868\u7684\u6bcf\u4e00\u884c\u90fd\u53ea\u9700\u8981\u4e0e Join Buffer \u4e2d\u7f13\u5b58\u7684\u90e8\u5206\u5916\u5c42\u8868\u884c\u8fdb\u884c\u6bd4\u8f83\uff0c\u800c\u4e0d\u9700\u8981\u626b\u63cf\u6574\u4e2a\u5185\u5c42\u8868\u3002<\/p>\n<p>\u4eca\u5929\u5173\u4e8e\u300aMySQL Block Nested-Loop Join (BNL) \u7b97\u6cd5\u4e2d\uff0c\u201c\u4e00\u6b21\u6027\u4e0e 100 \u884c\u6570\u636e\u8fdb\u884c\u6bd4\u8f83\u201d\u662f\u5982\u4f55\u5b9e\u73b0\u7684\uff1f\u300b\u7684\u5185\u5bb9\u5c31\u4ecb\u7ecd\u5230\u8fd9\u91cc\u4e86\uff0c\u662f\u4e0d\u662f\u5b66\u8d77\u6765\u4e00\u76ee\u4e86\u7136\uff01\u60f3\u8981\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u5185\u5bb9\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n<dl>\n<dt>\n <\/dt>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>MySQL Block Nested-Loop Join (BNL) \u7b97\u6cd5\u4e2d\uff0c\u201c\u4e00\u6b21\u6027\u4e0e 100 \u884c\u6570\u636e\u8fdb\u884c\u6bd4\u8f83\u201d\u662f\u5982\u4f55\u5b9e\u73b0\u7684\uff1f \u54c8\u55bd\uff01\u4eca\u5929\u5fc3\u8840\u6765\u6f6e\u7ed9\u5927\u5bb6\u5e26\u6765\u4e86\uff0c\u60f3\u5fc5\u5927\u5bb6\u5e94\u8be5\u5bf9\u90fd\u4e0d\u964c\u751f\u5427\uff0c\u90a3\u4e48\u9605\u8bfb\u672c\u6587\u5c31\u90fd\u4e0d\u4f1a\u5f88\u56f0\u96be\uff0c\u4ee5\u4e0b\u5185\u5bb9\u4e3b\u8981\u6d89\u53ca\u5230\uff0c\u82e5\u662f\u4f60\u6b63\u5728\u5b66\u4e60\uff0c\u5343\u4e07\u522b\u9519\u8fc7\u8fd9\u7bc7\u6587\u7ae0~\u5e0c\u671b\u80fd\u5e2e\u52a9\u5230\u4f60\uff01 MySQL Block Nested-Loop Join (BNL) \u7b97\u6cd5\u4f18\u5316 \u5bf9\u4e8e Block Nested-Loop Join (BNL) \u7b97\u6cd5\uff0c\u5176\u539f\u7406\u662f\u5c06\u5916\u5c42\u5faa\u73af\u7684\u884c\u7ed3\u679c\u96c6\u5b58\u50a8\u5728 Join Buffer \u4e2d\uff0c\u7136\u540e\u7528\u5185\u5c42\u8868\u7684\u6bcf\u4e00\u884c\u6570\u636e\u4e0e Join Buffer \u4e2d\u7684\u6240\u6709\u8bb0\u5f55\u8fdb\u884c\u6bd4\u8f83\u3002\u8fd9\u6837\u53ef\u4ee5\u51cf\u5c11\u5185\u5c42\u5faa\u73af\u7684\u626b\u63cf\u6b21\u6570\uff0c\u4ece\u800c\u4f18\u5316\u67e5\u8be2\u6027\u80fd\u3002 \u4e3e\u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\uff0c\u5982\u679c\u5916\u5c42\u5faa\u73af\u7ed3\u679c\u96c6\u6709 1000 \u884c\u6570\u636e\uff0c\u4f7f\u7528 Nested-Loop Join (NLJ) \u7b97\u6cd5\u9700\u8981\u626b\u63cf\u5185\u5c42\u8868 1000 \u6b21\u3002\u4f46\u662f\uff0c\u5982\u679c\u4f7f\u7528 BNL \u7b97\u6cd5\uff0c\u6211\u4eec\u5148\u53d6\u51fa\u5916\u5c42\u8868\u7ed3\u679c\u96c6\u7684 100 \u884c\u5b58\u50a8\u5230 Join Buffer \u4e2d\u3002\u7136\u540e\uff0c\u7528\u5185\u5c42\u8868\u7684\u6bcf\u4e00\u884c\u6570\u636e\u53bb\u548c\u8fd9 100 \u884c\u7ed3\u679c\u96c6\u505a\u6bd4\u8f83\u3002\u8fd9\u6837\uff0c\u5185\u5c42\u8868\u53ea\u9700\u8981\u5faa\u73af 1000\/100 = 10 \u6b21\uff0c\u51cf\u5c11\u4e86 9\/10 \u7684\u626b\u63cf\u6b21\u6570\u3002 \u7136\u800c\uff0c\u6709\u4eba\u63d0\u51fa\u4e86\u4e00\u4e2a\u95ee\u9898\uff1a\u201cJoin Buffer \u4e2d\u6709 10 [&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-45115","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/45115","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=45115"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/45115\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=45115"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=45115"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=45115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}