{"id":173,"date":"2026-01-23T02:12:38","date_gmt":"2026-01-23T02:12:38","guid":{"rendered":"https:\/\/blog.gpst.net.cn:4008\/?p=173"},"modified":"2026-01-28T06:24:15","modified_gmt":"2026-01-28T06:24:15","slug":"mysql%e8%bf%90%e7%bb%b4-%e6%9f%a5%e7%9c%8b%e6%8c%87%e5%ae%9a%e6%95%b0%e6%8d%ae%e5%ba%93-%e6%95%b0%e6%8d%ae%e8%a1%a8%e7%9a%84%e5%a4%a7%e5%b0%8f","status":"publish","type":"post","link":"https:\/\/opshub.com.cn\/?p=173","title":{"rendered":"MySQL\u8fd0\u7ef4\u2014\u2014\u67e5\u770b\u6307\u5b9a\u6570\u636e\u5e93 \/ \u6570\u636e\u8868\u7684\u5927\u5c0f"},"content":{"rendered":"\n<p>1\u3001\u67e5\u770b\u6307\u5b9a\u6570\u636e\u5e93\u7684\u603b\u5927\u5c0f<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT \n  CONCAT(ROUND(SUM(DATA_LENGTH + INDEX_LENGTH)\/1024\/1024,2),'MB') AS total_size,\n  CONCAT(ROUND(SUM(DATA_LENGTH)\/1024\/1024,2),'MB') AS data_size,\n  CONCAT(ROUND(SUM(INDEX_LENGTH)\/1024\/1024,2),'MB') AS index_size\nFROM information_schema.TABLES \nWHERE table_schema='\u6307\u5b9a\u5e93\u540d';<\/code><\/pre>\n\n\n\n<p>2\u3001\u67e5\u770b\u6307\u5b9a\u6570\u636e\u5e93\u4e2d\u6307\u5b9a\u8868\u7684\u5927\u5c0f<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT \n  CONCAT(ROUND((DATA_LENGTH + INDEX_LENGTH)\/1024\/1024,2),'MB') AS total_size,\n  CONCAT(ROUND(DATA_LENGTH\/1024\/1024,2),'MB') AS data_size,\n  CONCAT(ROUND(INDEX_LENGTH\/1024\/1024,2),'MB') AS index_size\nFROM information_schema.TABLES \nWHERE table_schema='\u6307\u5b9a\u5e93\u540d' AND table_name='\u6307\u5b9a\u8868\u540d';<\/code><\/pre>\n\n\n\n<p>3\u3001\u67e5\u770b\u6307\u5b9a\u5e93\u4e2d\u6240\u6709\u8868\u7684\u5927\u5c0f\uff08\u6309\u5927\u5c0f\u6392\u5e8f\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT \n  table_name AS \u8868\u540d,\n  CONCAT(ROUND((DATA_LENGTH + INDEX_LENGTH)\/1024\/1024,2),'MB') AS \u603b\u5927\u5c0f,\n  CONCAT(ROUND(DATA_LENGTH\/1024\/1024,2),'MB') AS \u6570\u636e\u5927\u5c0f,\n  CONCAT(ROUND(INDEX_LENGTH\/1024\/1024,2),'MB') AS \u7d22\u5f15\u5927\u5c0f\nFROM information_schema.TABLES \nWHERE table_schema='\u6307\u5b9a\u5e93\u540d'\nORDER BY (DATA_LENGTH + INDEX_LENGTH) DESC;  -- \u6309\u603b\u5927\u5c0f\u964d\u5e8f\u6392\u5217<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u67e5\u770b\u6307\u5b9a\u6570\u636e\u5e93\u7684\u603b\u5927\u5c0f 2\u3001\u67e5\u770b\u6307\u5b9a\u6570\u636e\u5e93\u4e2d\u6307\u5b9a\u8868\u7684\u5927\u5c0f 3\u3001\u67e5\u770b\u6307\u5b9a\u5e93\u4e2d\u6240\u6709\u8868\u7684\u5927\u5c0f\uff08\u6309\u5927\u5c0f\u6392\u5e8f\uff09<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-173","post","type-post","status-publish","format-standard","hentry","category-8"],"_links":{"self":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/173","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=173"}],"version-history":[{"count":1,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/173\/revisions"}],"predecessor-version":[{"id":174,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/173\/revisions\/174"}],"wp:attachment":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}