{"id":1274,"date":"2020-09-14T16:09:00","date_gmt":"2020-09-14T08:09:00","guid":{"rendered":"http:\/\/www.gbase8.cn\/?p=1274"},"modified":"2021-03-08T16:36:25","modified_gmt":"2021-03-08T08:36:25","slug":"gbase-8a-%e5%85%83%e6%95%b0%e6%8d%ae%e8%a1%a8%e4%bb%8b%e7%bb%8d%ef%bc%8c%e5%88%86%e5%8c%bapartitions","status":"publish","type":"post","link":"https:\/\/www.gbase8.cn\/en\/1274","title":{"rendered":"\u5357\u5927\u901a\u7528GBase 8a \u5143\u6570\u636e\u8868\u4ecb\u7ecd\uff0c\u5206\u533ainformation_schema.Partitions"},"content":{"rendered":"<p>GBase 8a\u6570\u636e\u5e93\u96c6\u7fa4\u4eceV95\u7248\u672c\u5f00\u59cb\u652f\u6301\u5206\u533a\uff0c\u5e76\u5728\u6570\u636e\u5e93\u7684information_schema.partitions\u91cc\u8bb0\u5f55\u4e86\u5143\u6570\u636e\u4fe1\u606f\u3002<\/p>\n\n\n\n<p>\u5176\u5b83\u5206\u533a\u8868\u4ecb\u7ecd\uff0c\u8bf7\u53c2\u8003\uff1a<br><a href=\"https:\/\/www.gbase8.cn\/en\/341\/\">GBase 8a\u96c6\u7fa4\u652f\u6301\u5206\u533a\u8868\u529f\u80fd\u4f7f\u7528\u6837\u4f8b<\/a><br><a href=\"https:\/\/www.gbase8.cn\/en\/1274\/\">GBase 8a \u5143\u6570\u636e\u8868\u4ecb\u7ecd<\/a><br><a href=\"https:\/\/www.gbase8.cn\/en\/5068\/\">GBase 8a\u5206\u533a\u8868\u6307\u5b9a\u7279\u5b9a\u5206\u533a\u7684\u67e5\u8be2\u65b9\u6cd5<\/a><\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Directory Navigation<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a2b0cd82a0d1\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a2b0cd82a0d1\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.gbase8.cn\/en\/1274\/#%E6%A0%B7%E4%BE%8B%E8%A1%A8\" >\u6837\u4f8b\u8868<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.gbase8.cn\/en\/1274\/#%E5%85%83%E6%95%B0%E6%8D%AE%E6%9F%A5%E8%AF%A2%E7%BB%93%E6%9E%9C\" >\u5143\u6570\u636e\u67e5\u8be2\u7ed3\u679c<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.gbase8.cn\/en\/1274\/#%E8%A1%A8%E7%BB%93%E6%9E%84%E6%8F%8F%E8%BF%B0\" >\u8868\u7ed3\u6784\u63cf\u8ff0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.gbase8.cn\/en\/1274\/#%E5%8F%82%E8%80%83\" >\u53c2\u8003<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%A0%B7%E4%BE%8B%E8%A1%A8\"><\/span>\u6837\u4f8b\u8868<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>create table p1(id int)\npartition by range(id)(\n  partition p1 values less than (10), \n  partition po values less than MAXVALUE\n);<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%85%83%E6%95%B0%E6%8D%AE%E6%9F%A5%E8%AF%A2%E7%BB%93%E6%9E%9C\"><\/span>\u5143\u6570\u636e\u67e5\u8be2\u7ed3\u679c<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; select * from information_schema.partitions where table_name='p1';\n+---------------+--------------+------------+----------------+-------------------+----------------------------+-------------------------------+------------------+---------------------+----------------------+-------------------------+-----------------------+------------+----------------+-------------+-----------------+--------------+-----------+---------------------+---------------------+------------+----------+-------------------+-----------+-----------------+\n| TABLE_CATALOG | TABLE_SCHEMA | TABLE_NAME | PARTITION_NAME | SUBPARTITION_NAME | PARTITION_ORDINAL_POSITION | SUBPARTITION_ORDINAL_POSITION | PARTITION_METHOD | SUBPARTITION_METHOD | PARTITION_EXPRESSION | SUBPARTITION_EXPRESSION | PARTITION_DESCRIPTION | TABLE_ROWS | AVG_ROW_LENGTH | DATA_LENGTH | MAX_DATA_LENGTH | INDEX_LENGTH | DATA_FREE | CREATE_TIME         | UPDATE_TIME         | CHECK_TIME | CHECKSUM | PARTITION_COMMENT | NODEGROUP | TABLESPACE_NAME |\n+---------------+--------------+------------+----------------+-------------------+----------------------------+-------------------------------+------------------+---------------------+----------------------+-------------------------+-----------------------+------------+----------------+-------------+-----------------+--------------+-----------+---------------------+---------------------+------------+----------+-------------------+-----------+-----------------+\n| NULL          | testdb       | p1         | p1             | NULL              |                          1 |                          NULL | RANGE            | NULL                | id                   | NULL                    | 10                    |          0 |              0 |           0 |            NULL |            0 |         0 | 2020-09-05 02:50:09 | 2020-09-05 02:50:09 | NULL       |     NULL |                   | default   | NULL            |\n| NULL          | testdb       | p1         | po             | NULL              |                          2 |                          NULL | RANGE            | NULL                | id                   | NULL                    | MAXVALUE              |          0 |              0 |           0 |            NULL |            0 |         0 | 2020-09-05 02:50:09 | 2020-09-05 02:50:09 | NULL       |     NULL |                   | default   | NULL            |\n+---------------+--------------+------------+----------------+-------------------+----------------------------+-------------------------------+------------------+---------------------+----------------------+-------------------------+-----------------------+------------+----------------+-------------+-----------------+--------------+-----------+---------------------+---------------------+------------+----------+-------------------+-----------+-----------------+\n2 rows in set (Elapsed: 00:00:00.01)\n\ngbase&gt; select * from partitions where table_name='p1'\\G\n*************************** 1. row ***************************\n                TABLE_CATALOG: NULL\n                 TABLE_SCHEMA: testdb\n                   TABLE_NAME: p1\n               PARTITION_NAME: p1\n            SUBPARTITION_NAME: NULL\n   PARTITION_ORDINAL_POSITION: 1\nSUBPARTITION_ORDINAL_POSITION: NULL\n             PARTITION_METHOD: RANGE\n          SUBPARTITION_METHOD: NULL\n         PARTITION_EXPRESSION: id\n      SUBPARTITION_EXPRESSION: NULL\n        PARTITION_DESCRIPTION: 10\n                   TABLE_ROWS: 0\n               AVG_ROW_LENGTH: 0\n                  DATA_LENGTH: 0\n              MAX_DATA_LENGTH: NULL\n                 INDEX_LENGTH: 0\n                    DATA_FREE: 0\n                  CREATE_TIME: 2020-09-05 02:50:09\n                  UPDATE_TIME: 2020-09-05 02:50:09\n                   CHECK_TIME: NULL\n                     CHECKSUM: NULL\n            PARTITION_COMMENT:\n                    NODEGROUP: default\n              TABLESPACE_NAME: NULL\n*************************** 2. row ***************************\n                TABLE_CATALOG: NULL\n                 TABLE_SCHEMA: testdb\n                   TABLE_NAME: p1\n               PARTITION_NAME: po\n            SUBPARTITION_NAME: NULL\n   PARTITION_ORDINAL_POSITION: 2\nSUBPARTITION_ORDINAL_POSITION: NULL\n             PARTITION_METHOD: RANGE\n          SUBPARTITION_METHOD: NULL\n         PARTITION_EXPRESSION: id\n      SUBPARTITION_EXPRESSION: NULL\n        PARTITION_DESCRIPTION: MAXVALUE\n                   TABLE_ROWS: 0\n               AVG_ROW_LENGTH: 0\n                  DATA_LENGTH: 0\n              MAX_DATA_LENGTH: NULL\n                 INDEX_LENGTH: 0\n                    DATA_FREE: 0\n                  CREATE_TIME: 2020-09-05 02:50:09\n                  UPDATE_TIME: 2020-09-05 02:50:09\n                   CHECK_TIME: NULL\n                     CHECKSUM: NULL\n            PARTITION_COMMENT:\n                    NODEGROUP: default\n              TABLESPACE_NAME: NULL\n2 rows in set (Elapsed: 00:00:00.00)\n\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E8%A1%A8%E7%BB%93%E6%9E%84%E6%8F%8F%E8%BF%B0\"><\/span>\u8868\u7ed3\u6784\u63cf\u8ff0<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u5217\u540d<\/th><th>\u542b\u4e49<\/th><\/tr><\/thead><tbody><tr><td>TABLE_CATALOG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>&nbsp;<\/td><\/tr><tr><td>TABLE_SCHEMA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>&nbsp;\u5e93\u540d<\/td><\/tr><tr><td>TABLE_NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>&nbsp;\u8868\u540d<\/td><\/tr><tr><td>PARTITION_NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>&nbsp;\u5206\u533a\u540d\u5b57<\/td><\/tr><tr><td>SUBPARTITION_NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>&nbsp;<\/td><\/tr><tr><td>PARTITION_ORDINAL_POSITION&nbsp;&nbsp;<\/td><td>&nbsp;\u4f4d\u7f6e<\/td><\/tr><tr><td>SUBPARTITION_ORDINAL_POSITION<\/td><td>&nbsp;<\/td><\/tr><tr><td>PARTITION_METHOD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>&nbsp;\u5206\u533a\u7c7b\u578b\uff0c\u6bd4\u5982RANGE<\/td><\/tr><tr><td>SUBPARTITION_METHOD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>&nbsp;<\/td><\/tr><tr><td>PARTITION_EXPRESSION&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>&nbsp;\u5206\u533a\u8868\u8fbe\u5f0f\u6216\u503c<\/td><\/tr><tr><td>SUBPARTITION_EXPRESSION&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>&nbsp;<\/td><\/tr><tr><td>PARTITION_DESCRIPTION&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>&nbsp;\u63cf\u8ff0<\/td><\/tr><tr><td>TABLE_ROWS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>&nbsp;\u5206\u533a\u91cc\u7684\u884c\u6570(gnode\u5206\u7247\u624d\u6709)<\/td><\/tr><tr><td>AVG_ROW_LENGTH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>&nbsp;\u5e73\u5747\u884c\u5bbd<\/td><\/tr><tr><td>DATA_LENGTH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>&nbsp;\u6570\u636e\u957f\u5ea6<\/td><\/tr><tr><td>MAX_DATA_LENGTH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>&nbsp;<\/td><\/tr><tr><td>INDEX_LENGTH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>&nbsp;<\/td><\/tr><tr><td>DATA_FREE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>&nbsp;<\/td><\/tr><tr><td>CREATE_TIME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>&nbsp;\u521b\u5efa\u65f6\u95f4<\/td><\/tr><tr><td>UPDATE_TIME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>&nbsp;\u66f4\u65b0\u65f6\u95f4<\/td><\/tr><tr><td>CHECK_TIME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>&nbsp;<\/td><\/tr><tr><td>CHECKSUM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>&nbsp;<\/td><\/tr><tr><td>PARTITION_COMMENT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>&nbsp;\u5907\u6ce8<\/td><\/tr><tr><td>NODEGROUP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>&nbsp;default<\/td><\/tr><tr><td>TABLESPACE_NAME&nbsp;<\/td><td>&nbsp;\u8868\u7a7a\u95f4\u540d\u5b57<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%8F%82%E8%80%83\"><\/span>\u53c2\u8003<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-\u8001\u7d2b\u7af9\u7684\u5bb6 wp-block-embed-\u8001\u7d2b\u7af9\u7684\u5bb6\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"PD1bAUw8Hk\"><a href=\"https:\/\/www.gbase8.cn\/en\/341\/\">GBase 8a\u96c6\u7fa4\u652f\u6301\u5206\u533a\u8868\u529f\u80fd\u4f7f\u7528\u6837\u4f8b<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"\u300aGBase 8a\u96c6\u7fa4\u652f\u6301\u5206\u533a\u8868\u529f\u80fd\u4f7f\u7528\u6837\u4f8b\u300b\u2014\u8001\u7d2b\u7af9\u7684\u5bb6\" src=\"https:\/\/www.gbase8.cn\/341\/embed#?secret=PD1bAUw8Hk\" data-secret=\"PD1bAUw8Hk\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>","protected":false},"excerpt":{"rendered":"<p>\u5357\u5927\u901a\u7528GBase 8a\u6570\u636e\u5e93\u96c6\u7fa4\u4eceV95\u7248\u672c\u5f00\u59cb\u652f\u6301\u5206\u533a\uff0c\u5e76\u5728\u6570\u636e\u5e93\u7684information_schema.partitions\u91cc\u8bb0\u5f55\u4e86\u5143\u6570\u636e\u4fe1\u606f\u3002<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[69,80],"class_list":["post-1274","post","type-post","status-publish","format-standard","hentry","category-gbase8a","tag-69","tag-80"],"_links":{"self":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/1274","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/comments?post=1274"}],"version-history":[{"count":5,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/1274\/revisions"}],"predecessor-version":[{"id":5079,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/1274\/revisions\/5079"}],"wp:attachment":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/media?parent=1274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/categories?post=1274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/tags?post=1274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}