{"id":12556,"date":"2025-02-26T14:31:35","date_gmt":"2025-02-26T06:31:35","guid":{"rendered":"https:\/\/www.gbase8.cn\/?p=12556"},"modified":"2025-02-26T14:31:37","modified_gmt":"2025-02-26T06:31:37","slug":"gbase-8a%e5%bb%ba%e8%a1%a8%e6%97%b6%e5%93%88%e5%b8%8chash%e5%88%86%e5%b8%83%e5%88%97%e6%94%af%e6%8c%81%e7%9a%84%e5%ad%97%e6%ae%b5%e7%b1%bb%e5%9e%8b","status":"publish","type":"post","link":"https:\/\/www.gbase8.cn\/en\/12556","title":{"rendered":"GBase 8a\u5efa\u8868\u65f6\u54c8\u5e0chash\u5206\u5e03\u5217\u652f\u6301\u7684\u5b57\u6bb5\u7c7b\u578b"},"content":{"rendered":"<p>GBase 8a \u7248\u672c\u652f\u6301\u6574\u5f62(int,bigint)\uff0c\u5b57\u7b26\u578b(varchar)\u548cdecimal\u7c7b\u578b\u7684\u5b57\u6bb5\uff0c\u4f5c\u4e3a\u54c8\u5e0chash\u5206\u5e03\u5217\u3002<\/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-6a2aa4f9e3700\" 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-6a2aa4f9e3700\"  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\/12556\/#%E6%B5%8B%E8%AF%95%E7%89%88%E6%9C%AC\" >\u6d4b\u8bd5\u7248\u672c<\/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\/12556\/#%E6%95%B4%E5%BD%A2%E5%88%86%E5%B8%83%E5%88%97\" >\u6574\u5f62\u5206\u5e03\u5217<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.gbase8.cn\/en\/12556\/#int\" >int<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.gbase8.cn\/en\/12556\/#bigint\" >bigint<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.gbase8.cn\/en\/12556\/#smallint\" >smallint<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.gbase8.cn\/en\/12556\/#%E5%AD%97%E7%AC%A6%E5%9E%8B%E5%88%86%E5%B8%83%E5%88%97\" >\u5b57\u7b26\u578b\u5206\u5e03\u5217<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.gbase8.cn\/en\/12556\/#varchar\" >varchar<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.gbase8.cn\/en\/12556\/#decimal%E5%88%86%E5%B8%83%E5%88%97\" >decimal\u5206\u5e03\u5217<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%B5%8B%E8%AF%95%E7%89%88%E6%9C%AC\"><\/span>\u6d4b\u8bd5\u7248\u672c<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>8.6.2.43-R35.5\n9.5.3.28.18<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%95%B4%E5%BD%A2%E5%88%86%E5%B8%83%E5%88%97\"><\/span>\u6574\u5f62\u5206\u5e03\u5217<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u539f\u5219\u4e0a\uff0c\u54c8\u5e0chash\u5206\u5e03\u5217\uff0c\u4f7f\u7528int\u548cbigint\u5373\u53ef\u3002\u5176\u5b83\u7684smallint\u548ctinyint\u867d\u7136\u8bed\u6cd5\u4e0a\u6ca1\u62a5\u9519\uff0c\u4f46\u4ece\u5b9e\u9645\u751f\u4ea7\u73af\u5883\u770b\uff0c\u4e0d\u5efa\u8bae\u4f7f\u7528\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"int\"><\/span>int<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>gbase> create table td_int(id int,name varchar(100))distributed by('id');\r\nQuery OK, 0 rows affected (Elapsed: 00:00:00.23)\n\ngbase> show create table td_int;\r\n+--------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n| Table  | Create Table                                                                                                                                                                   |\r\n+--------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n| td_int | CREATE TABLE \"td_int\" (\r\n  \"id\" int(11) DEFAULT NULL,\r\n  \"name\" varchar(100) DEFAULT NULL\r\n) ENGINE=EXPRESS DISTRIBUTED BY('id') DEFAULT CHARSET=utf8 TABLESPACE='sys_tablespace' |\r\n+--------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n1 row in set (Elapsed: 00:00:00.00)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"bigint\"><\/span>bigint<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>gbase> create table td_bigint(id bigint,name varchar(100))distributed by('id');\r\nQuery OK, 0 rows affected (Elapsed: 00:00:00.21)\r\n\ngbase> show create table td_bigint;\r\n+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n| Table     | Create Table                                                                                                                                                                         |\r\n+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n| td_bigint | CREATE TABLE \"td_bigint\" (\r\n  \"id\" bigint(20) DEFAULT NULL,\r\n  \"name\" varchar(100) DEFAULT NULL\r\n) ENGINE=EXPRESS DISTRIBUTED BY('id') DEFAULT CHARSET=utf8 TABLESPACE='sys_tablespace' |\r\n+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n1 row in set (Elapsed: 00:00:00.00)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"smallint\"><\/span>smallint<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>gbase> create table td_smallint(id smallint,name varchar(100))distributed by('id');\r\nQuery OK, 0 rows affected (Elapsed: 00:00:00.24)\r\n\r\ngbase> show create table td_smallint;\r\n+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n| Table       | Create Table                                                                                                                                                                            |\r\n+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n| td_smallint | CREATE TABLE \"td_smallint\" (\r\n  \"id\" smallint(6) DEFAULT NULL,\r\n  \"name\" varchar(100) DEFAULT NULL\r\n) ENGINE=EXPRESS DISTRIBUTED BY('id') DEFAULT CHARSET=utf8 TABLESPACE='sys_tablespace' |\r\n+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n1 row in set (Elapsed: 00:00:00.00)\r\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%AD%97%E7%AC%A6%E5%9E%8B%E5%88%86%E5%B8%83%E5%88%97\"><\/span>\u5b57\u7b26\u578b\u5206\u5e03\u5217<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u4ec5\u652f\u6301varchar\u7c7b\u578b\uff0c\u4e0d\u652f\u6301char\u7c7b\u578b\u548ctext\u7c7b\u578b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>gbase> create table td_char(id tinyint,name char(100))distributed by('name');\r\nERROR 1721 (HY000): (GBA-02DD-0003) Type of distributed column 'name' is incorrect.\r\ngbase>\r\ngbase> create table td_text(id tinyint,name text)distributed by('name');\r\nERROR 1721 (HY000): (GBA-02DD-0003) Type of distributed column 'name' is incorrect.\r\ngbase>\r\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"varchar\"><\/span>varchar<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>gbase> create table td_varchar(id tinyint,name varchar(100))distributed by('name');\r\nQuery OK, 0 rows affected (Elapsed: 00:00:00.20)\r\n\r\ngbase> show create table td_varchar;\r\n+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n| Table      | Create Table                                                                                                                                                                            |\r\n+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n| td_varchar | CREATE TABLE \"td_varchar\" (\r\n  \"id\" tinyint(4) DEFAULT NULL,\r\n  \"name\" varchar(100) DEFAULT NULL\r\n) ENGINE=EXPRESS DISTRIBUTED BY('name') DEFAULT CHARSET=utf8 TABLESPACE='sys_tablespace' |\r\n+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n1 row in set (Elapsed: 00:00:00.00)\r\n\r\ngbase>\r\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"decimal%E5%88%86%E5%B8%83%E5%88%97\"><\/span>decimal\u5206\u5e03\u5217<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>gbase> create table td_decimal(id decimal(18,3),name text)distributed by('id');\r\nQuery OK, 0 rows affected (Elapsed: 00:00:00.22)\r\n\r\ngbase> show create table td_decimal;\r\n+------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n| Table      | Create Table                                                                                                                                                        |\r\n+------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n| td_decimal | CREATE TABLE \"td_decimal\" (\r\n  \"id\" decimal(18,3) DEFAULT NULL,\r\n  \"name\" text\r\n) ENGINE=EXPRESS DISTRIBUTED BY('id') DEFAULT CHARSET=utf8 TABLESPACE='sys_tablespace' |\r\n+------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n1 row in set (Elapsed: 00:00:00.00)\r\n<\/code><\/pre>","protected":false},"excerpt":{"rendered":"<p>GBase 8a \u7248\u672c\u652f\u6301\u6574\u5f62(int,bigint)\uff0c\u5b57\u7b26\u578b(varchar)\u548cdecimal\u7c7b\u578b\u7684\u5b57\u6bb5\uff0c\u4f5c\u4e3a\u54c8\u5e0chash\u5206\u5e03\u5217\u3002<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-12556","post","type-post","status-publish","format-standard","hentry","category-gbase8a"],"_links":{"self":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/12556","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=12556"}],"version-history":[{"count":3,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/12556\/revisions"}],"predecessor-version":[{"id":13017,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/12556\/revisions\/13017"}],"wp:attachment":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/media?parent=12556"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/categories?post=12556"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/tags?post=12556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}