{"id":170181,"date":"2024-11-06T21:49:18","date_gmt":"2024-11-06T13:49:18","guid":{"rendered":"https:\/\/server.hk\/cnblog\/170181\/"},"modified":"2024-11-06T21:49:18","modified_gmt":"2024-11-06T13:49:18","slug":"%e7%9b%a4%e5%8d%80%e7%b5%b1%e8%a8%88%ef%bc%9a%e4%ba%86%e8%a7%a3%e6%95%b8%e6%93%9a%e5%ba%ab%e4%b8%ad%e6%9c%89%e5%a4%9a%e5%b0%91%e5%80%8b%e7%9b%a4%e5%8d%80-%e6%95%b8%e6%93%9a%e5%ba%ab%e6%9c%89%e5%a4%9a","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/170181\/","title":{"rendered":"\u76e4\u5340\u7d71\u8a08\uff1a\u4e86\u89e3\u6578\u64da\u5eab\u4e2d\u6709\u591a\u5c11\u500b\u76e4\u5340 (\u6578\u64da\u5eab\u6709\u591a\u5c11 \u76e4\u5340)"},"content":{"rendered":"<h1 id=\"%e7%9b%a4%e5%8d%80%e7%b5%b1%e8%a8%88%ef%bc%9a%e4%ba%86%e8%a7%a3%e6%95%b8%e6%93%9a%e5%ba%ab%e4%b8%ad%e6%9c%89%e5%a4%9a%e5%b0%91%e5%80%8b%e7%9b%a4%e5%8d%80-eXuuqXdFUs\">\u76e4\u5340\u7d71\u8a08\uff1a\u4e86\u89e3\u6578\u64da\u5eab\u4e2d\u6709\u591a\u5c11\u500b\u76e4\u5340<\/h1>\n<p>\u5728\u6578\u64da\u5eab\u7ba1\u7406\u4e2d\uff0c\u76e4\u5340\uff08Partition\uff09\u662f\u4e00\u7a2e\u5c07\u6578\u64da\u5206\u5272\u6210\u66f4\u5c0f\u3001\u66f4\u6613\u65bc\u7ba1\u7406\u7684\u90e8\u5206\u7684\u6280\u8853\u3002\u9019\u7a2e\u6280\u8853\u4e0d\u50c5\u80fd\u63d0\u9ad8\u67e5\u8a62\u6027\u80fd\uff0c\u9084\u80fd\u7c21\u5316\u6578\u64da\u7684\u7dad\u8b77\u548c\u7ba1\u7406\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0e\u5982\u4f55\u5728\u6578\u64da\u5eab\u4e2d\u9032\u884c\u76e4\u5340\u7d71\u8a08\uff0c\u4e26\u4e86\u89e3\u6578\u64da\u5eab\u4e2d\u6709\u591a\u5c11\u500b\u76e4\u5340\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af%e7%9b%a4%e5%8d%80%ef%bc%9f-eXuuqXdFUs\">\u4ec0\u9ebc\u662f\u76e4\u5340\uff1f<\/h2>\n<p>\u76e4\u5340\u662f\u6578\u64da\u5eab\u4e2d\u7684\u4e00\u500b\u908f\u8f2f\u5206\u5340\uff0c\u901a\u5e38\u7528\u65bc\u5c07\u5927\u578b\u8868\u683c\u5206\u5272\u6210\u66f4\u5c0f\u7684\u90e8\u5206\u3002\u6bcf\u500b\u76e4\u5340\u53ef\u4ee5\u6839\u64da\u7279\u5b9a\u7684\u689d\u4ef6\uff08\u5982\u7bc4\u570d\u3001\u5217\u8868\u6216\u54c8\u5e0c\uff09\u4f86\u5283\u5206\u3002\u9019\u6a23\u7684\u5283\u5206\u4e0d\u50c5\u6709\u52a9\u65bc\u63d0\u9ad8\u67e5\u8a62\u6548\u7387\uff0c\u9084\u80fd\u5728\u6578\u64da\u7dad\u8b77\u6642\u6e1b\u5c11\u5f71\u97ff\u7bc4\u570d\u3002<\/p>\n<h2 id=\"%e7%9b%a4%e5%8d%80%e7%9a%84%e9%a1%9e%e5%9e%8b-eXuuqXdFUs\">\u76e4\u5340\u7684\u985e\u578b<\/h2>\n<ul>\n<li><strong>\u7bc4\u570d\u76e4\u5340\uff08Range Partitioning\uff09<\/strong>\uff1a\u6839\u64da\u67d0\u500b\u5217\u7684\u503c\u7bc4\u570d\u4f86\u5283\u5206\u76e4\u5340\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u5c07\u65e5\u671f\u5217\u5283\u5206\u70ba\u4e0d\u540c\u7684\u5e74\u4efd\u3002<\/li>\n<li><strong>\u5217\u8868\u76e4\u5340\uff08List Partitioning\uff09<\/strong>\uff1a\u6839\u64da\u7279\u5b9a\u7684\u503c\u5217\u8868\u4f86\u5283\u5206\u76e4\u5340\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u5c07\u5730\u5340\u5283\u5206\u70ba\u4e0d\u540c\u7684\u76e4\u5340\u3002<\/li>\n<li><strong>\u54c8\u5e0c\u76e4\u5340\uff08Hash Partitioning\uff09<\/strong>\uff1a\u6839\u64da\u54c8\u5e0c\u51fd\u6578\u7684\u7d50\u679c\u4f86\u5283\u5206\u76e4\u5340\uff0c\u9019\u6a23\u53ef\u4ee5\u5747\u52fb\u5206\u914d\u6578\u64da\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%a6%82%e4%bd%95%e7%b5%b1%e8%a8%88%e6%95%b8%e6%93%9a%e5%ba%ab%e4%b8%ad%e7%9a%84%e7%9b%a4%e5%8d%80-eXuuqXdFUs\">\u5982\u4f55\u7d71\u8a08\u6578\u64da\u5eab\u4e2d\u7684\u76e4\u5340<\/h2>\n<p>\u5728\u6578\u64da\u5eab\u4e2d\u7d71\u8a08\u76e4\u5340\u7684\u6578\u91cf\u901a\u5e38\u9700\u8981\u4f7f\u7528\u7279\u5b9a\u7684\u67e5\u8a62\u8a9e\u53e5\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u898b\u7684\u6578\u64da\u5eab\u7cfb\u7d71\u4e2d\u7528\u65bc\u67e5\u8a62\u76e4\u5340\u7684\u793a\u4f8b\uff1a<\/p>\n<h3 id=\"%e5%9c%a8-mysql-%e4%b8%ad%e6%9f%a5%e8%a9%a2%e7%9b%a4%e5%8d%80-eXuuqXdFUs\">\u5728 MySQL \u4e2d\u67e5\u8a62\u76e4\u5340<\/h3>\n<pre><code>SELECT \n    table_name, \n    partition_ordinal_position, \n    partition_method \nFROM \n    information_schema.partitions \nWHERE \n    table_schema = 'your_database_name';<\/code><\/pre>\n<p>\u9019\u6bb5\u67e5\u8a62\u5c07\u8fd4\u56de\u6307\u5b9a\u6578\u64da\u5eab\u4e2d\u6240\u6709\u8868\u7684\u76e4\u5340\u4fe1\u606f\uff0c\u5305\u62ec\u8868\u540d\u3001\u76e4\u5340\u7684\u5e8f\u865f\u548c\u76e4\u5340\u65b9\u6cd5\u3002<\/p>\n<h3 id=\"%e5%9c%a8-postgresql-%e4%b8%ad%e6%9f%a5%e8%a9%a2%e7%9b%a4%e5%8d%80-eXuuqXdFUs\">\u5728 PostgreSQL \u4e2d\u67e5\u8a62\u76e4\u5340<\/h3>\n<pre><code>SELECT \n    inhrelid::regclass AS partition_name \nFROM \n    pg_inherits \nWHERE \n    inhparent = 'your_table_name'::regclass;<\/code><\/pre>\n<p>\u9019\u6bb5\u67e5\u8a62\u5c07\u8fd4\u56de\u6307\u5b9a\u8868\u7684\u6240\u6709\u5b50\u76e4\u5340\uff08\u5373\u76e4\u5340\u8868\uff09\u7684\u540d\u7a31\u3002<\/p>\n<h2 id=\"%e7%9b%a4%e5%8d%80%e7%9a%84%e5%84%aa%e5%8b%a2-eXuuqXdFUs\">\u76e4\u5340\u7684\u512a\u52e2<\/h2>\n<p>\u4f7f\u7528\u76e4\u5340\u6280\u8853\u7684\u4e3b\u8981\u512a\u52e2\u5305\u62ec\uff1a<\/p>\n<ul>\n<li><strong>\u6027\u80fd\u63d0\u5347<\/strong>\uff1a\u67e5\u8a62\u6642\u53ea\u9700\u6383\u63cf\u76f8\u95dc\u7684\u76e4\u5340\uff0c\u800c\u4e0d\u662f\u6574\u500b\u8868\uff0c\u5f9e\u800c\u63d0\u9ad8\u67e5\u8a62\u901f\u5ea6\u3002<\/li>\n<li><strong>\u7dad\u8b77\u65b9\u4fbf<\/strong>\uff1a\u53ef\u4ee5\u55ae\u7368\u7ba1\u7406\u6bcf\u500b\u76e4\u5340\uff0c\u4f8b\u5982\u522a\u9664\u904e\u671f\u6578\u64da\u6642\uff0c\u53ea\u9700\u522a\u9664\u7279\u5b9a\u7684\u76e4\u5340\u3002<\/li>\n<li><strong>\u6578\u64da\u5206\u4f48\u5747\u52fb<\/strong>\uff1a\u901a\u904e\u5408\u7406\u7684\u76e4\u5340\u8a2d\u8a08\uff0c\u53ef\u4ee5\u5be6\u73fe\u6578\u64da\u7684\u5747\u52fb\u5206\u4f48\uff0c\u907f\u514d\u67d0\u4e9b\u76e4\u5340\u904e\u65bc\u9f90\u5927\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b5%90%e8%ab%96-eXuuqXdFUs\">\u7d50\u8ad6<\/h2>\n<p>\u76e4\u5340\u6280\u8853\u5728\u6578\u64da\u5eab\u7ba1\u7406\u4e2d\u626e\u6f14\u8457\u91cd\u8981\u89d2\u8272\uff0c\u80fd\u5920\u6709\u6548\u63d0\u5347\u6027\u80fd\u548c\u7c21\u5316\u7dad\u8b77\u3002\u4e86\u89e3\u5982\u4f55\u7d71\u8a08\u6578\u64da\u5eab\u4e2d\u7684\u76e4\u5340\u6578\u91cf\uff0c\u5c0d\u65bc\u6578\u64da\u5eab\u7ba1\u7406\u54e1\u4f86\u8aaa\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\u6280\u80fd\u3002\u900f\u904e\u9069\u7576\u7684\u67e5\u8a62\u8a9e\u53e5\uff0c\u7ba1\u7406\u54e1\u53ef\u4ee5\u8f15\u9b06\u7372\u53d6\u6240\u9700\u7684\u76e4\u5340\u4fe1\u606f\uff0c\u5f9e\u800c\u66f4\u597d\u5730\u7ba1\u7406\u548c\u512a\u5316\u6578\u64da\u5eab\u3002<\/p>\n<p>\u5982\u679c\u60a8\u5c0d\u65bc <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u53ca\u5176\u5728\u6578\u64da\u5eab\u7ba1\u7406\u4e2d\u7684\u61c9\u7528\u6709\u8208\u8da3\uff0c\u6b61\u8fce\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u4ee5\u7372\u53d6\u66f4\u591a\u8cc7\u8a0a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e86\u89e3\u6578\u64da\u5eab\u4e2d\u7684\u76e4\u5340\u7d71\u8a08\uff0c\u5feb\u901f\u67e5\u8a62\u548c\u5206\u6790\u6578\u64da\u5eab\u4e2d\u64c1\u6709\u7684\u76e4\u5340\u6578\u91cf\uff0c\u52a9\u60a8\u512a\u5316\u6578\u64da\u7ba1\u7406\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-170181","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/170181","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=170181"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/170181\/revisions"}],"predecessor-version":[{"id":170182,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/170181\/revisions\/170182"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=170181"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=170181"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=170181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}