{"id":95561,"date":"2026-08-26T15:56:45","date_gmt":"2026-08-26T07:56:45","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/95561.html"},"modified":"2026-08-26T15:56:45","modified_gmt":"2026-08-26T07:56:45","slug":"kingbasees%e5%88%86%e5%8c%ba%e8%a1%a8%e4%bd%bf%e7%94%a8%e6%8c%87%e5%8d%97%ef%bc%9a%e8%a7%a3%e5%86%b3%e5%b8%b8%e8%a7%81%e9%97%ae%e9%a2%98%e6%8f%90%e5%8d%87%e6%80%a7%e8%83%bd","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/95561.html","title":{"rendered":"KingbaseES\u5206\u533a\u8868\u4f7f\u7528\u6307\u5357\uff1a\u89e3\u51b3\u5e38\u89c1\u95ee\u9898\u63d0\u5347\u6027\u80fd"},"content":{"rendered":"<li>KingbaseES\u5206\u533a\u8868\u57fa\u7840\u6982\u5ff5\u4e0e\u4f18\u52bf<\/li>\n<p>KingbaseES\u5206\u533a\u8868\u662f\u5c06\u903b\u8f91\u4e0a\u4e00\u4e2a\u5927\u8868\u5206\u5272\u6210\u591a\u4e2a\u7269\u7406\u4e0a smaller\u3001\u66f4\u6613\u7ba1\u7406\u7684\u90e8\u5206\u7684\u6280\u672f\u3002\u6bcf\u4e2a\u5206\u533a\u6709\u81ea\u5df1\u7684\u540d\u79f0\u548c\u5b58\u50a8\u7279\u6027&#xff0c;\u4f46\u4ece\u7528\u6237\u89d2\u5ea6\u4ecd\u7136\u662f\u4e00\u4e2a\u5b8c\u6574\u7684\u8868\u3002<\/p>\n<\/p>\n<p>\u521b\u5efa\u5206\u533a\u8868\u7684\u57fa\u672c\u8bed\u6cd5&#xff1a;<\/p>\n<p>CREATE TABLE sales (<br \/>\n    id INT,<br \/>\n    sale_date DATE,<br \/>\n    amount NUMERIC<br \/>\n) PARTITION BY RANGE (sale_date);<\/p>\n<p>\u5206\u533a\u8868\u7684\u4e3b\u8981\u4f18\u52bf\u5305\u62ec&#xff1a;<\/p>\n<ul>\n<li>\u63d0\u9ad8\u67e5\u8be2\u6027\u80fd&#xff1a;\u67e5\u8be2\u65f6\u53ea\u9700\u626b\u63cf\u76f8\u5173\u5206\u533a<\/li>\n<li>\u7b80\u5316\u7ba1\u7406&#xff1a;\u53ef\u72ec\u7acb\u5bf9\u5206\u533a\u8fdb\u884c\u7ef4\u62a4\u64cd\u4f5c<\/li>\n<li>\u589e\u52a0\u53ef\u7528\u6027&#xff1a;\u67d0\u4e2a\u5206\u533a\u51fa\u73b0\u95ee\u9898\u4e0d\u5f71\u54cd\u5176\u4ed6\u5206\u533a<\/li>\n<li>\u63d0\u9ad8\u6570\u636e\u52a0\u8f7d\u901f\u5ea6&#xff1a;\u53ef\u5e76\u884c\u52a0\u8f7d\u4e0d\u540c\u5206\u533a\u7684\u6570\u636e<\/li>\n<\/ul>\n<p>\u7ed3\u8bba&#xff1a;\u5408\u7406\u4f7f\u7528\u5206\u533a\u8868\u80fd\u591f\u663e\u8457\u63d0\u5347\u5927\u6570\u636e\u91cf\u573a\u666f\u4e0b\u7684\u6570\u636e\u5e93\u6027\u80fd&#xff0c;\u4f46\u9700\u8981\u6839\u636e\u4e1a\u52a1\u7279\u70b9\u9009\u62e9\u5408\u9002\u7684\u5206\u533a\u7b56\u7565\u3002<\/p>\n<\/p>\n<li>\u5e38\u89c1\u5206\u533a\u8868\u521b\u5efa\u4e0e\u7ba1\u7406\u95ee\u9898<\/li>\n<p>\u521b\u5efa\u5206\u533a\u8868\u65f6\u5e38\u89c1\u95ee\u9898\u5305\u62ec&#xff1a;<\/p>\n<\/p>\n<li>\u5206\u533a\u952e\u9009\u62e9\u4e0d\u5f53<\/li>\n<p>   \u95ee\u9898&#xff1a;\u9009\u62e9\u9ad8\u57fa\u6570\u7684\u5217\u4f5c\u4e3a\u5206\u533a\u952e\u53ef\u80fd\u5bfc\u81f4\u5927\u91cf\u5c0f\u5206\u533a<\/p>\n<p>   \u89e3\u51b3&#xff1a;\u9009\u62e9\u67e5\u8be2\u9891\u7e41\u3001\u5177\u6709\u826f\u597d\u533a\u5206\u5ea6\u7684\u5217\u4f5c\u4e3a\u5206\u533a\u952e<\/p>\n<\/p>\n<li>\u5206\u533a\u6570\u91cf\u89c4\u5212\u4e0d\u5408\u7406<\/li>\n<p>   \u95ee\u9898&#xff1a;\u5206\u533a\u6570\u91cf\u8fc7\u5c11\u6216\u8fc7\u591a\u5f71\u54cd\u6027\u80fd<\/p>\n<p>   \u89e3\u51b3&#xff1a;\u6839\u636e\u6570\u636e\u91cf\u548c\u67e5\u8be2\u6a21\u5f0f\u786e\u5b9a\u5408\u9002\u7684\u5206\u533a\u6570\u91cf&#xff0c;\u4e00\u822c\u5efa\u8bae\u6bcf\u4e2a\u5206\u533a\u5927\u5c0f\u5728GB\u7ea7\u522b<\/p>\n<\/p>\n<li>\u5206\u533a\u7ef4\u62a4\u64cd\u4f5c\u5931\u8d25<\/li>\n<p>   \u95ee\u9898&#xff1a;\u6dfb\u52a0\u3001\u5220\u9664\u6216\u4fee\u6539\u5206\u533a\u65f6\u51fa\u73b0\u9519\u8bef<\/p>\n<p>   \u89e3\u51b3&#xff1a;\u786e\u4fdd\u5206\u533a\u952e\u503c\u8303\u56f4\u4e0d\u91cd\u53e0&#xff0c;\u6267\u884c\u7ef4\u62a4\u64cd\u4f5c\u524d\u5907\u4efd\u6570\u636e<\/p>\n<\/p>\n<p>&#8212; \u521b\u5efa\u9500\u552e\u6570\u636e\u5206\u533a\u8868\u793a\u4f8b<br \/>\nCREATE TABLE sales (<br \/>\n    id INT,<br \/>\n    sale_date DATE,<br \/>\n    amount NUMERIC,<br \/>\n    customer_id INT<br \/>\n) PARTITION BY RANGE (sale_date);<\/p>\n<p>&#8212; \u521b\u5efa2023\u5e74\u5404\u5b63\u5ea6\u5206\u533a<br \/>\nCREATE TABLE sales_q1_2023 PARTITION OF sales<br \/>\n    FOR VALUES FROM (&#039;2023-01-01&#039;) TO (&#039;2023-04-01&#039;);<\/p>\n<p>CREATE TABLE sales_q2_2023 PARTITION OF sales<br \/>\n    FOR VALUES FROM (&#039;2023-04-01&#039;) TO (&#039;2023-07-01&#039;);<\/p>\n<p>CREATE TABLE sales_q3_2023 PARTITION OF sales<br \/>\n    FOR VALUES FROM (&#039;2023-07-01&#039;) TO (&#039;2023-10-01&#039;);<\/p>\n<p>CREATE TABLE sales_q4_2023 PARTITION OF sales<br \/>\n    FOR VALUES FROM (&#039;2023-10-01&#039;) TO (&#039;2024-01-01&#039;);<\/p>\n<p>\u7ed3\u8bba&#xff1a;\u521b\u5efa\u5206\u533a\u8868\u65f6\u9700\u8c28\u614e\u9009\u62e9\u5206\u533a\u952e\u548c\u5206\u533a\u6570\u91cf&#xff0c;\u5408\u7406\u89c4\u5212\u5206\u533a\u7ed3\u6784\u624d\u80fd\u53d1\u6325\u5206\u533a\u8868\u7684\u6700\u5927\u6548\u80fd\u3002<\/p>\n<\/p>\n<li>\u5206\u533a\u8868\u67e5\u8be2\u6027\u80fd\u4f18\u5316\u6280\u5de7<\/li>\n<p>\u5206\u533a\u8868\u67e5\u8be2\u4f18\u5316\u5e38\u89c1\u6280\u5de7&#xff1a;<\/p>\n<\/p>\n<li>\u4f7f\u7528\u5206\u533a\u88c1\u526a<\/li>\n<p>   KingbaseES\u4f1a\u81ea\u52a8\u8bc6\u522b\u67e5\u8be2\u6761\u4ef6\u4e2d\u7684\u5206\u533a\u952e\u503c&#xff0c;\u53ea\u626b\u63cf\u76f8\u5173\u5206\u533a\u3002\u786e\u4fdd\u67e5\u8be2\u5305\u542b\u5206\u533a\u952e\u6761\u4ef6\u4ee5\u542f\u7528\u5206\u533a\u88c1\u526a\u3002<\/p>\n<\/p>\n<li>\u907f\u514d\u8de8\u5206\u533a\u5168\u8868\u626b\u63cf<\/li>\n<p>   \u4e0d\u4f7f\u7528\u5206\u533a\u952e\u6761\u4ef6\u7684\u67e5\u8be2\u4f1a\u5bfc\u81f4\u6240\u6709\u5206\u533a\u90fd\u88ab\u626b\u63cf&#xff0c;\u4e25\u91cd\u5f71\u54cd\u6027\u80fd\u3002<\/p>\n<\/p>\n<li>\u5408\u7406\u4f7f\u7528\u5206\u533a\u7d22\u5f15<\/li>\n<p>   \u4e3a\u6bcf\u4e2a\u5206\u533a\u521b\u5efa\u672c\u5730\u7d22\u5f15&#xff0c;\u53ef\u6839\u636e\u67e5\u8be2\u6a21\u5f0f\u9009\u62e9\u5168\u5c40\u6216\u5c40\u90e8\u7d22\u5f15\u3002<\/p>\n<\/p>\n<li>\u8003\u8651\u5206\u533a\u88c1\u526a\u7edf\u8ba1\u4fe1\u606f\u66f4\u65b0<\/li>\n<p>&#8212; \u67e5\u770b\u5206\u533a\u88c1\u526a\u662f\u5426\u751f\u6548<br \/>\nEXPLAIN ANALYZE SELECT * FROM sales WHERE sale_date BETWEEN &#039;2023-03-01&#039; AND &#039;2023-06-30&#039;;<\/p>\n<p>&#8212; \u521b\u5efa\u5206\u533a\u7d22\u5f15<br \/>\nCREATE INDEX idx_sales_q1_2023 ON sales_q1_2023 (id);<br \/>\nCREATE INDEX idx_sales_q2_2023 ON sales_q2_2023 (id);<\/p>\n<p>\u5206\u533a\u88c1\u526a\u5de5\u4f5c\u6d41\u7a0b&#xff1a;<\/p>\n<p>#publish-mermaid-1787502429546-0{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#publish-mermaid-1787502429546-0 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#publish-mermaid-1787502429546-0 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#publish-mermaid-1787502429546-0 .error-icon{fill:#552222;}#publish-mermaid-1787502429546-0 .error-text{fill:#552222;stroke:#552222;}#publish-mermaid-1787502429546-0 .edge-thickness-normal{stroke-width:1px;}#publish-mermaid-1787502429546-0 .edge-thickness-thick{stroke-width:3.5px;}#publish-mermaid-1787502429546-0 .edge-pattern-solid{stroke-dasharray:0;}#publish-mermaid-1787502429546-0 .edge-thickness-invisible{stroke-width:0;fill:none;}#publish-mermaid-1787502429546-0 .edge-pattern-dashed{stroke-dasharray:3;}#publish-mermaid-1787502429546-0 .edge-pattern-dotted{stroke-dasharray:2;}#publish-mermaid-1787502429546-0 .marker{fill:#333333;stroke:#333333;}#publish-mermaid-1787502429546-0 .marker.cross{stroke:#333333;}#publish-mermaid-1787502429546-0 svg{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;}#publish-mermaid-1787502429546-0 p{margin:0;}#publish-mermaid-1787502429546-0 .label{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;color:#333;}#publish-mermaid-1787502429546-0 .cluster-label text{fill:#333;}#publish-mermaid-1787502429546-0 .cluster-label span{color:#333;}#publish-mermaid-1787502429546-0 .cluster-label span p{background-color:transparent;}#publish-mermaid-1787502429546-0 .label text,#publish-mermaid-1787502429546-0 span{fill:#333;color:#333;}#publish-mermaid-1787502429546-0 .node rect,#publish-mermaid-1787502429546-0 .node circle,#publish-mermaid-1787502429546-0 .node ellipse,#publish-mermaid-1787502429546-0 .node polygon,#publish-mermaid-1787502429546-0 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#publish-mermaid-1787502429546-0 .rough-node .label text,#publish-mermaid-1787502429546-0 .node .label text,#publish-mermaid-1787502429546-0 .image-shape .label,#publish-mermaid-1787502429546-0 .icon-shape .label{text-anchor:middle;}#publish-mermaid-1787502429546-0 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#publish-mermaid-1787502429546-0 .rough-node .label,#publish-mermaid-1787502429546-0 .node .label,#publish-mermaid-1787502429546-0 .image-shape .label,#publish-mermaid-1787502429546-0 .icon-shape .label{text-align:center;}#publish-mermaid-1787502429546-0 .node.clickable{cursor:pointer;}#publish-mermaid-1787502429546-0 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#publish-mermaid-1787502429546-0 .arrowheadPath{fill:#333333;}#publish-mermaid-1787502429546-0 .edgePath .path{stroke:#333333;stroke-width:1px;}#publish-mermaid-1787502429546-0 .flowchart-link{stroke:#333333;fill:none;}#publish-mermaid-1787502429546-0 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-1787502429546-0 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#publish-mermaid-1787502429546-0 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-1787502429546-0 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#publish-mermaid-1787502429546-0 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#publish-mermaid-1787502429546-0 .cluster text{fill:#333;}#publish-mermaid-1787502429546-0 .cluster span{color:#333;}#publish-mermaid-1787502429546-0 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#publish-mermaid-1787502429546-0 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#publish-mermaid-1787502429546-0 rect.text{fill:none;stroke-width:0;}#publish-mermaid-1787502429546-0 .icon-shape,#publish-mermaid-1787502429546-0 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-1787502429546-0 .icon-shape p,#publish-mermaid-1787502429546-0 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#publish-mermaid-1787502429546-0 .icon-shape .label rect,#publish-mermaid-1787502429546-0 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-1787502429546-0 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#publish-mermaid-1787502429546-0 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#publish-mermaid-1787502429546-0 .node .neo-node{stroke:#9370DB;}#publish-mermaid-1787502429546-0 [data-look=\\&#8221;neo\\&#8221;].node rect,#publish-mermaid-1787502429546-0 [data-look=\\&#8221;neo\\&#8221;].cluster rect,#publish-mermaid-1787502429546-0 [data-look=\\&#8221;neo\\&#8221;].node polygon{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1787502429546-0 [data-look=\\&#8221;neo\\&#8221;].swimlane.cluster rect{filter:none;}#publish-mermaid-1787502429546-0 [data-look=\\&#8221;neo\\&#8221;].node path{stroke:#9370DB;stroke-width:1px;}#publish-mermaid-1787502429546-0 [data-look=\\&#8221;neo\\&#8221;].node .outer-path{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1787502429546-0 [data-look=\\&#8221;neo\\&#8221;].node .neo-line path{stroke:#9370DB;filter:none;}#publish-mermaid-1787502429546-0 [data-look=\\&#8221;neo\\&#8221;].node circle{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1787502429546-0 [data-look=\\&#8221;neo\\&#8221;].node circle .state-start{fill:#000000;}#publish-mermaid-1787502429546-0 [data-look=\\&#8221;neo\\&#8221;].icon-shape .icon{fill:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1787502429546-0 [data-look=\\&#8221;neo\\&#8221;].icon-shape .icon-neo path{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1787502429546-0 :root{&#8211;mermaid-font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;}\u5305\u542b\u5206\u533a\u952e\u6761\u4ef6\u4e0d\u5305\u542b\u5206\u533a\u952e\u6761\u4ef6<span class=\"nodeLabel\"><\/p>\n<p>SQL\u67e5\u8be2<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u5206\u6790\u67e5\u8be2\u6761\u4ef6<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u786e\u5b9a\u76f8\u5173\u5206\u533a<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u626b\u63cf\u6240\u6709\u5206\u533a<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u4ec5\u626b\u63cf\u76f8\u5173\u5206\u533a<\/p>\n<p><\/span><span class=\"nodeLabel\"><\/p>\n<p>\u8fd4\u56de\u67e5\u8be2\u7ed3\u679c<\/p>\n<p><\/span><\/p>\n<p>\u7ed3\u8bba&#xff1a;\u5408\u7406\u5229\u7528\u5206\u533a\u88c1\u526a\u548c\u7d22\u5f15\u6280\u672f\u53ef\u663e\u8457\u63d0\u5347\u5206\u533a\u8868\u67e5\u8be2\u6027\u80fd&#xff0c;\u907f\u514d\u5168\u8868\u626b\u63cf\u3002<\/p>\n<\/p>\n<li>\u5206\u533a\u8868\u7ef4\u62a4\u4e0e\u6545\u969c\u6392\u67e5\u65b9\u6cd5<\/li>\n<p>\u5206\u533a\u8868\u5e38\u89c1\u7ef4\u62a4\u4e0e\u6545\u969c\u6392\u67e5&#xff1a;<\/p>\n<\/p>\n<li>\u5206\u533a\u7ba1\u7406<\/li>\n<ul>\n<li>\u6dfb\u52a0\u65b0\u5206\u533a&#xff1a;\u4f7f\u7528PARTITION OF FOR VALUES\u8bed\u6cd5<\/li>\n<li>\u5220\u9664\u5206\u533a&#xff1a;\u4f7f\u7528DROP PARTITION\u8bed\u53e5<\/li>\n<li>\u5408\u5e76\u5206\u533a&#xff1a;\u53ef\u8003\u8651\u521b\u5efa\u65b0\u5206\u533a\u540e\u5220\u9664\u65e7\u5206\u533a<\/li>\n<\/ul>\n<li>\u5206\u533a\u7ef4\u62a4\u64cd\u4f5c<\/li>\n<ul>\n<li>\u5206\u533a\u91cd\u5efa&#xff1a;ALTER TABLE &#8230; REBUILD PARTITION<\/li>\n<li>\u5206\u533a\u6536\u7f29&#xff1a;ALTER TABLE &#8230; SHRINK PARTITION<\/li>\n<li>\u5206\u533a\u7edf\u8ba1\u4fe1\u606f\u66f4\u65b0&#xff1a;ANALYZE PARTITION<\/li>\n<\/ul>\n<li>\u6545\u969c\u6392\u67e5\u8981\u70b9<\/li>\n<ul>\n<li>\u68c0\u67e5\u5206\u533a\u5b8c\u6574\u6027&#xff1a;\u67e5\u8be2\u7cfb\u7edf\u89c6\u56fepg_partitions<\/li>\n<li>\u5206\u533a\u7a7a\u95f4\u4f7f\u7528\u60c5\u51b5&#xff1a;\u67e5\u8be2pg_total_relation_size<\/li>\n<li>\u5206\u533a\u7d22\u5f15\u72b6\u6001&#xff1a;\u68c0\u67e5\u7d22\u5f15\u6709\u6548\u6027<\/li>\n<\/ul>\n<p>&#8212; \u68c0\u67e5\u5206\u533a\u4fe1\u606f<br \/>\nSELECT schemaname, tablename, partitionname, partitions FROM pg_partitions<br \/>\nWHERE tablename &#061; &#039;sales&#039;;<\/p>\n<p>&#8212; \u6dfb\u52a0\u65b0\u5206\u533a<br \/>\nCREATE TABLE sales_q1_2024 PARTITION OF sales<br \/>\n    FOR VALUES FROM (&#039;2024-01-01&#039;) TO (&#039;2024-04-01&#039;);<\/p>\n<p>&#8212; \u5220\u9664\u65e7\u5206\u533a<br \/>\nDROP PARTITION sales_q1_2023;<\/p>\n<p>&#8212; \u66f4\u65b0\u5206\u533a\u7edf\u8ba1\u4fe1\u606f<br \/>\nANALYZE sales PARTITION (sales_q1_2023);<\/p>\n<p>\u7ed3\u8bba&#xff1a;\u5b9a\u671f\u7ef4\u62a4\u548c\u53ca\u65f6\u6392\u67e5\u5206\u533a\u8868\u95ee\u9898\u53ef\u786e\u4fdd\u7cfb\u7edf\u7a33\u5b9a\u8fd0\u884c&#xff0c;\u5206\u533a\u7ef4\u62a4\u64cd\u4f5c\u9700\u8c28\u614e\u6267\u884c&#xff0c;\u7279\u522b\u662f\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u3002<\/p>\n<\/p>\n<h4>\u6700\u5c0f\u793a\u4f8b\u4e0e\u6ce8\u610f\u4e8b\u9879<\/h4>\n<\/p>\n<p>&#8212; \u521b\u5efa\u6d4b\u8bd5\u5206\u533a\u8868\u793a\u4f8b<br \/>\nCREATE TABLE test_partition (<br \/>\n    id INT,<br \/>\n    data VARCHAR(100),<br \/>\n    create_time TIMESTAMP<br \/>\n) PARTITION BY RANGE (create_time);<\/p>\n<p>&#8212; \u521b\u5efa\u4e24\u4e2a\u6d4b\u8bd5\u5206\u533a<br \/>\nCREATE TABLE test_partition_2023 PARTITION OF test_partition<br \/>\n    FOR VALUES FROM (&#039;2023-01-01 00:00:00&#039;) TO (&#039;2024-01-01 00:00:00&#039;);<\/p>\n<p>CREATE TABLE test_partition_2024 PARTITION OF test_partition<br \/>\n    FOR VALUES FROM (&#039;2024-01-01 00:00:00&#039;) TO (&#039;2025-01-01 00:00:00&#039;);<\/p>\n<p>&#8212; \u63d2\u5165\u6d4b\u8bd5\u6570\u636e<br \/>\nINSERT INTO test_partition (id, data, create_time) VALUES<br \/>\n(1, &#039;test1&#039;, &#039;2023-05-15 10:00:00&#039;),<br \/>\n(2, &#039;test2&#039;, &#039;2023-08-20 14:30:00&#039;),<br \/>\n(3, &#039;test3&#039;, &#039;2024-02-10 09:15:00&#039;);<\/p>\n<p>&#8212; \u67e5\u8be2\u6d4b\u8bd5\u6570\u636e<br \/>\nSELECT * FROM test_partition WHERE create_time &gt;&#061; &#039;2023-06-01 00:00:00&#039;;<\/p>\n<p>\u6ce8\u610f\u4e8b\u9879&#xff1a;<\/p>\n<li>\u5206\u533a\u952e\u503c\u8303\u56f4\u5fc5\u987b\u4e0d\u91cd\u53e0&#xff0c;\u5426\u5219\u521b\u5efa\u4f1a\u5931\u8d25<\/li>\n<li>\u5206\u533a\u952e\u5e94\u8be5\u662f\u67e5\u8be2\u9891\u7e41\u4f7f\u7528\u7684\u6761\u4ef6&#xff0c;\u624d\u80fd\u53d1\u6325\u5206\u533a\u88c1\u526a\u4f18\u52bf<\/li>\n<li>\u5b9a\u671f\u68c0\u67e5\u5206\u533a\u8868\u6027\u80fd&#xff0c;\u5fc5\u8981\u65f6\u8c03\u6574\u5206\u533a\u7b56\u7565<\/li>\n<li>\u5206\u533a\u8868\u7ef4\u62a4\u64cd\u4f5c(\u5982\u5220\u9664\u5206\u533a)\u4e0d\u53ef\u9006&#xff0c;\u64cd\u4f5c\u524d\u52a1\u5fc5\u5907\u4efd\u6570\u636e<\/li>\n<li>\u5206\u533a\u6570\u91cf\u4e0d\u5b9c\u8fc7\u591a&#xff0c;\u4e00\u822c\u5efa\u8bae\u4e0d\u8d85\u8fc7100\u4e2a\u5206\u533a<\/li>\n","protected":false},"excerpt":{"rendered":"<p>KingbaseES\u5206\u533a\u8868\u57fa\u7840\u6982\u5ff5\u4e0e\u4f18\u52bfKingbaseES\u5206\u533a\u8868\u662f\u5c06\u903b\u8f91\u4e0a\u4e00\u4e2a\u5927\u8868\u5206\u5272\u6210\u591a\u4e2a\u7269\u7406\u4e0a smaller\u3001\u66f4\u6613\u7ba1\u7406\u7684\u90e8\u5206\u7684\u6280\u672f\u3002\u6bcf\u4e2a\u5206\u533a\u6709\u81ea\u5df1\u7684\u540d\u79f0\u548c\u5b58\u50a8\u7279\u6027&#xff0c;\u4f46\u4ece\u7528\u6237\u89d2\u5ea6\u4ecd\u7136\u662f\u4e00\u4e2a\u5b8c\u6574\u7684\u8868\u3002\u521b\u5efa\u5206\u533a\u8868\u7684\u57fa\u672c\u8bed\u6cd5&#xff1a;<br \/>\nCREATE TABLE sales (id INT,sale_date DATE,amount NUMERIC<br \/>\n) PARTITION BY RANGE (sale_date);\u5206\u533a\u8868\u7684\u4e3b\u8981\u4f18\u52bf\u5305\u62ec&#xff1a;<br \/>\n\u63d0\u9ad8\u67e5<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[10954,10955,6178,2500,3962],"topic":[],"class_list":["post-95561","post","type-post","status-publish","format-standard","hentry","category-server","tag-10954","tag-10955","tag-kingbasees","tag-2500","tag-3962"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>KingbaseES\u5206\u533a\u8868\u4f7f\u7528\u6307\u5357\uff1a\u89e3\u51b3\u5e38\u89c1\u95ee\u9898\u63d0\u5347\u6027\u80fd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/95561.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"KingbaseES\u5206\u533a\u8868\u4f7f\u7528\u6307\u5357\uff1a\u89e3\u51b3\u5e38\u89c1\u95ee\u9898\u63d0\u5347\u6027\u80fd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"KingbaseES\u5206\u533a\u8868\u57fa\u7840\u6982\u5ff5\u4e0e\u4f18\u52bfKingbaseES\u5206\u533a\u8868\u662f\u5c06\u903b\u8f91\u4e0a\u4e00\u4e2a\u5927\u8868\u5206\u5272\u6210\u591a\u4e2a\u7269\u7406\u4e0a smaller\u3001\u66f4\u6613\u7ba1\u7406\u7684\u90e8\u5206\u7684\u6280\u672f\u3002\u6bcf\u4e2a\u5206\u533a\u6709\u81ea\u5df1\u7684\u540d\u79f0\u548c\u5b58\u50a8\u7279\u6027&#xff0c;\u4f46\u4ece\u7528\u6237\u89d2\u5ea6\u4ecd\u7136\u662f\u4e00\u4e2a\u5b8c\u6574\u7684\u8868\u3002\u521b\u5efa\u5206\u533a\u8868\u7684\u57fa\u672c\u8bed\u6cd5&#xff1a; CREATE TABLE sales (id INT,sale_date DATE,amount NUMERIC ) PARTITION BY RANGE (sale_date);\u5206\u533a\u8868\u7684\u4e3b\u8981\u4f18\u52bf\u5305\u62ec&#xff1a; \u63d0\u9ad8\u67e5\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/95561.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-26T07:56:45+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/95561.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/95561.html\",\"name\":\"KingbaseES\u5206\u533a\u8868\u4f7f\u7528\u6307\u5357\uff1a\u89e3\u51b3\u5e38\u89c1\u95ee\u9898\u63d0\u5347\u6027\u80fd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-26T07:56:45+00:00\",\"dateModified\":\"2026-08-26T07:56:45+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/95561.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/95561.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/95561.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"KingbaseES\u5206\u533a\u8868\u4f7f\u7528\u6307\u5357\uff1a\u89e3\u51b3\u5e38\u89c1\u95ee\u9898\u63d0\u5347\u6027\u80fd\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"KingbaseES\u5206\u533a\u8868\u4f7f\u7528\u6307\u5357\uff1a\u89e3\u51b3\u5e38\u89c1\u95ee\u9898\u63d0\u5347\u6027\u80fd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/95561.html","og_locale":"zh_CN","og_type":"article","og_title":"KingbaseES\u5206\u533a\u8868\u4f7f\u7528\u6307\u5357\uff1a\u89e3\u51b3\u5e38\u89c1\u95ee\u9898\u63d0\u5347\u6027\u80fd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"KingbaseES\u5206\u533a\u8868\u57fa\u7840\u6982\u5ff5\u4e0e\u4f18\u52bfKingbaseES\u5206\u533a\u8868\u662f\u5c06\u903b\u8f91\u4e0a\u4e00\u4e2a\u5927\u8868\u5206\u5272\u6210\u591a\u4e2a\u7269\u7406\u4e0a smaller\u3001\u66f4\u6613\u7ba1\u7406\u7684\u90e8\u5206\u7684\u6280\u672f\u3002\u6bcf\u4e2a\u5206\u533a\u6709\u81ea\u5df1\u7684\u540d\u79f0\u548c\u5b58\u50a8\u7279\u6027&#xff0c;\u4f46\u4ece\u7528\u6237\u89d2\u5ea6\u4ecd\u7136\u662f\u4e00\u4e2a\u5b8c\u6574\u7684\u8868\u3002\u521b\u5efa\u5206\u533a\u8868\u7684\u57fa\u672c\u8bed\u6cd5&#xff1a; CREATE TABLE sales (id INT,sale_date DATE,amount NUMERIC ) PARTITION BY RANGE (sale_date);\u5206\u533a\u8868\u7684\u4e3b\u8981\u4f18\u52bf\u5305\u62ec&#xff1a; \u63d0\u9ad8\u67e5","og_url":"https:\/\/www.wsisp.com\/helps\/95561.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-26T07:56:45+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/95561.html","url":"https:\/\/www.wsisp.com\/helps\/95561.html","name":"KingbaseES\u5206\u533a\u8868\u4f7f\u7528\u6307\u5357\uff1a\u89e3\u51b3\u5e38\u89c1\u95ee\u9898\u63d0\u5347\u6027\u80fd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-26T07:56:45+00:00","dateModified":"2026-08-26T07:56:45+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/95561.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/95561.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/95561.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"KingbaseES\u5206\u533a\u8868\u4f7f\u7528\u6307\u5357\uff1a\u89e3\u51b3\u5e38\u89c1\u95ee\u9898\u63d0\u5347\u6027\u80fd"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/95561","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=95561"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/95561\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=95561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=95561"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=95561"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=95561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}