{"id":45810,"date":"2024-12-01T13:08:16","date_gmt":"2024-12-01T05:08:16","guid":{"rendered":"https:\/\/fwq.ai\/blog\/45810\/"},"modified":"2024-12-01T13:08:16","modified_gmt":"2024-12-01T05:08:16","slug":"%e5%a6%82%e4%bd%95%e6%9f%a5%e7%9c%8bmysql%e5%8d%95%e4%b8%aa%e7%b4%a2%e5%bc%95%e7%9a%84%e7%a3%81%e7%9b%98%e7%a9%ba%e9%97%b4%e4%bd%bf%e7%94%a8%e6%83%85%e5%86%b5%ef%bc%9f-3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/45810\/","title":{"rendered":"\u5982\u4f55\u67e5\u770bMySQL\u5355\u4e2a\u7d22\u5f15\u7684\u78c1\u76d8\u7a7a\u95f4\u4f7f\u7528\u60c5\u51b5\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>\u5982\u4f55\u67e5\u770bMySQL\u5355\u4e2a\u7d22\u5f15\u7684\u78c1\u76d8\u7a7a\u95f4\u4f7f\u7528\u60c5\u51b5\uff1f<\/h1>\n<p>\u79ef\u7d2f\u77e5\u8bc6\uff0c\u80dc\u8fc7\u79ef\u84c4\u91d1\u94f6\uff01\u6bd5\u7adf\u5728\u6570\u636e\u5e93\u5f00\u53d1\u7684\u8fc7\u7a0b\u4e2d\uff0c\u4f1a\u9047\u5230\u5404\u79cd\u5404\u6837\u7684\u95ee\u9898\uff0c\u5f80\u5f80\u90fd\u662f\u4e00\u4e9b\u7ec6\u8282\u77e5\u8bc6\u70b9\u8fd8\u6ca1\u6709\u638c\u63e1\u597d\u800c\u5bfc\u81f4\u7684\uff0c\u56e0\u6b64\u57fa\u7840\u77e5\u8bc6\u70b9\u7684\u79ef\u7d2f\u662f\u5f88\u91cd\u8981\u7684\u3002\u4e0b\u9762\u672c\u6587\u300a\u5982\u4f55\u67e5\u770bMySQL\u5355\u4e2a\u7d22\u5f15\u7684\u78c1\u76d8\u7a7a\u95f4\u4f7f\u7528\u60c5\u51b5\uff1f\u300b\uff0c\u5c31\u5e26\u5927\u5bb6\u8bb2\u89e3\u4e00\u4e0b\u77e5\u8bc6\u70b9\uff0c\u82e5\u662f\u4f60\u5bf9\u672c\u6587\u611f\u5174\u8da3\uff0c\u6216\u8005\u662f\u60f3\u641e\u61c2\u5176\u4e2d\u67d0\u4e2a\u77e5\u8bc6\u70b9\uff0c\u5c31\u8bf7\u4f60\u7ee7\u7eed\u5f80\u4e0b\u770b\u5427~<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241117\/173180794567394ac9a848a.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u67e5\u770bMySQL\u5355\u4e2a\u7d22\u5f15\u7684\u78c1\u76d8\u7a7a\u95f4\u4f7f\u7528\u60c5\u51b5\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u67e5\u770bMySQL\u5355\u4e2a\u7d22\u5f15\u7684\u78c1\u76d8\u7a7a\u95f4\u4f7f\u7528\u60c5\u51b5\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u67e5\u770b mysql \u7d22\u5f15\u78c1\u76d8\u7a7a\u95f4\u4f7f\u7528\u60c5\u51b5<\/strong><\/p>\n<p>\u5728 mysql \u4e2d\uff0cshow table status; \u547d\u4ee4\u53ea\u80fd\u663e\u793a\u6240\u6709\u7d22\u5f15\u7684\u603b\u78c1\u76d8\u7a7a\u95f4\u5360\u7528\u60c5\u51b5\u3002\u4f46\u662f\uff0c\u901a\u8fc7\u67e5\u8be2 information_schema.files \u8868\uff0c\u53ef\u4ee5\u83b7\u53d6\u6bcf\u4e2a\u7d22\u5f15\u7684\u78c1\u76d8\u7a7a\u95f4\u4f7f\u7528\u60c5\u51b5\uff1a<\/p>\n<pre>SELECT\n    table_schema,\n    table_name,\n    index_name,\n    file_size\nFROM\n    INFORMATION_SCHEMA.FILES\nWHERE\n    table_schema = '&lt;your_database_name&gt;'\n    AND table_name = '&lt;your_table_name&gt;'\n    AND index_name IS NOT NULL;<\/pre>\n<p><strong>\u6ce8\u610f\uff1a<\/strong><br \/>\u8be5\u67e5\u8be2\u7ed3\u679c\u4e2d\u7684 file_size \u5b57\u6bb5\u8868\u793a\u7d22\u5f15\u6240\u5728\u8868\u7a7a\u95f4\u7684\u6587\u4ef6\u5927\u5c0f\uff0c\u800c\u4e0d\u662f\u7d22\u5f15\u672c\u8eab\u7684\u5927\u5c0f\u3002\u8981\u83b7\u5f97\u66f4\u51c6\u786e\u7684\u7d22\u5f15\u5927\u5c0f\uff0c\u53ef\u4ee5\u4f7f\u7528 mysql \u7684 analyze table \u547d\u4ee4\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u672c\u6587\u7684\u5168\u90e8\u5185\u5bb9\u4e86\uff0c\u662f\u5426\u6709\u987a\u5229\u5e2e\u52a9\u4f60\u89e3\u51b3\u95ee\u9898\uff1f\u82e5\u662f\u80fd\u7ed9\u4f60\u5e26\u6765\u5b66\u4e60\u4e0a\u7684\u5e2e\u52a9\uff0c\u8bf7\u5927\u5bb6\u591a\u591a\u652f\u6301\u7c73\u4e91\uff01\u66f4\u591a\u5173\u4e8e\u6570\u636e\u5e93\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u4e5f\u53ef\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\u3002<\/p>\n<dl>\n<dt>\n <\/dt>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u67e5\u770bMySQL\u5355\u4e2a\u7d22\u5f15\u7684\u78c1\u76d8\u7a7a\u95f4\u4f7f\u7528\u60c5\u51b5\uff1f \u79ef\u7d2f\u77e5\u8bc6\uff0c\u80dc\u8fc7\u79ef\u84c4\u91d1\u94f6\uff01\u6bd5\u7adf\u5728\u6570\u636e\u5e93\u5f00\u53d1\u7684\u8fc7\u7a0b\u4e2d\uff0c\u4f1a\u9047\u5230\u5404\u79cd\u5404\u6837\u7684\u95ee\u9898\uff0c\u5f80\u5f80\u90fd\u662f\u4e00\u4e9b\u7ec6\u8282\u77e5\u8bc6\u70b9\u8fd8\u6ca1\u6709\u638c\u63e1\u597d\u800c\u5bfc\u81f4\u7684\uff0c\u56e0\u6b64\u57fa\u7840\u77e5\u8bc6\u70b9\u7684\u79ef\u7d2f\u662f\u5f88\u91cd\u8981\u7684\u3002\u4e0b\u9762\u672c\u6587\u300a\u5982\u4f55\u67e5\u770bMySQL\u5355\u4e2a\u7d22\u5f15\u7684\u78c1\u76d8\u7a7a\u95f4\u4f7f\u7528\u60c5\u51b5\uff1f\u300b\uff0c\u5c31\u5e26\u5927\u5bb6\u8bb2\u89e3\u4e00\u4e0b\u77e5\u8bc6\u70b9\uff0c\u82e5\u662f\u4f60\u5bf9\u672c\u6587\u611f\u5174\u8da3\uff0c\u6216\u8005\u662f\u60f3\u641e\u61c2\u5176\u4e2d\u67d0\u4e2a\u77e5\u8bc6\u70b9\uff0c\u5c31\u8bf7\u4f60\u7ee7\u7eed\u5f80\u4e0b\u770b\u5427~ \u67e5\u770b mysql \u7d22\u5f15\u78c1\u76d8\u7a7a\u95f4\u4f7f\u7528\u60c5\u51b5 \u5728 mysql \u4e2d\uff0cshow table status; \u547d\u4ee4\u53ea\u80fd\u663e\u793a\u6240\u6709\u7d22\u5f15\u7684\u603b\u78c1\u76d8\u7a7a\u95f4\u5360\u7528\u60c5\u51b5\u3002\u4f46\u662f\uff0c\u901a\u8fc7\u67e5\u8be2 information_schema.files \u8868\uff0c\u53ef\u4ee5\u83b7\u53d6\u6bcf\u4e2a\u7d22\u5f15\u7684\u78c1\u76d8\u7a7a\u95f4\u4f7f\u7528\u60c5\u51b5\uff1a SELECT table_schema, table_name, index_name, file_size FROM INFORMATION_SCHEMA.FILES WHERE table_schema = &#8216;&lt;your_database_name&gt;&#8217; AND table_name = &#8216;&lt;your_table_name&gt;&#8217; AND index_name IS NOT NULL; \u6ce8\u610f\uff1a\u8be5\u67e5\u8be2\u7ed3\u679c\u4e2d\u7684 file_size \u5b57\u6bb5\u8868\u793a\u7d22\u5f15\u6240\u5728\u8868\u7a7a\u95f4\u7684\u6587\u4ef6\u5927\u5c0f\uff0c\u800c\u4e0d\u662f\u7d22\u5f15\u672c\u8eab\u7684\u5927\u5c0f\u3002\u8981\u83b7\u5f97\u66f4\u51c6\u786e\u7684\u7d22\u5f15\u5927\u5c0f\uff0c\u53ef\u4ee5\u4f7f\u7528 mysql \u7684 analyze table \u547d\u4ee4\u3002 \u4ee5\u4e0a\u5c31\u662f\u672c\u6587\u7684\u5168\u90e8\u5185\u5bb9\u4e86\uff0c\u662f\u5426\u6709\u987a\u5229\u5e2e\u52a9\u4f60\u89e3\u51b3\u95ee\u9898\uff1f\u82e5\u662f\u80fd\u7ed9\u4f60\u5e26\u6765\u5b66\u4e60\u4e0a\u7684\u5e2e\u52a9\uff0c\u8bf7\u5927\u5bb6\u591a\u591a\u652f\u6301\u7c73\u4e91\uff01\u66f4\u591a\u5173\u4e8e\u6570\u636e\u5e93\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u4e5f\u53ef\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\u3002<\/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-45810","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/45810","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=45810"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/45810\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=45810"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=45810"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=45810"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}