{"id":6327,"date":"2021-06-09T11:34:14","date_gmt":"2021-06-09T03:34:14","guid":{"rendered":"https:\/\/www.gbase8.cn\/?p=6327"},"modified":"2021-06-09T11:34:15","modified_gmt":"2021-06-09T03:34:15","slug":"gbase-8a-%e7%94%a8%e6%88%b7%e5%88%9b%e5%bb%ba%e4%b8%b4%e6%97%b6%e8%a1%a8temporary%e7%9a%84%e5%86%85%e9%83%a8%e5%ae%9e%e7%8e%b0%e5%91%bd%e5%90%8d%e8%a7%84%e5%88%99","status":"publish","type":"post","link":"https:\/\/www.gbase8.cn\/en\/6327","title":{"rendered":"\u5357\u5927\u901a\u7528GBase 8a \u7528\u6237\u521b\u5efa\u4e34\u65f6\u8868Temporary\u7684\u5185\u90e8\u5b9e\u73b0\u547d\u540d\u89c4\u5219"},"content":{"rendered":"<p>GBase 8a\u652f\u6301\u521b\u5efaTemporary\u8868\uff0c\u5141\u8bb8\u4e0d\u540c\u7684session\u4f7f\u7528\u76f8\u540c\u7684\u4e34\u65f6\u8868\u540d\u5b57\u800c\u4e0d\u4f1a\u51b2\u7a81\u3002\u8fd9\u4e9b\u8868\u5728session\u5173\u95ed\u65f6\u4f1a\u81ea\u52a8\u9500\u6bc1\u3002\u4f46\u5982\u679c\u4f7f\u7528\u4e86\u8fde\u63a5\u6c60\uff0c\u8fd8\u662f\u4f1a\u6709\u51b2\u7a81\uff0c\u6240\u4ee5\u8fd8\u662f\u5efa\u8bae\u7528\u6237\u81ea\u884c\u9500\u6bc1\u4e34\u65f6\u8868\u3002\u6216\u8005\u5728\u4f7f\u7528\u524d\u5220\u9664\u53ef\u80fd\u5b58\u5728\u7684\u4e34\u65f6\u8868\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-6a2b2c9390cb8\" 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-6a2b2c9390cb8\"  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\/6327\/#%E4%B8%B4%E6%97%B6%E8%A1%A8%E8%AF%AD%E6%B3%95\" >\u4e34\u65f6\u8868\u8bed\u6cd5<\/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\/6327\/#%E6%A0%B7%E4%BE%8B\" >\u6837\u4f8b<\/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\/6327\/#%E5%88%9B%E5%BB%BA%E6%99%AE%E9%80%9A%E4%B8%B4%E6%97%B6%E8%A1%A8\" >\u521b\u5efa\u666e\u901a\u4e34\u65f6\u8868<\/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\/6327\/#%E4%BD%BF%E7%94%A8like%E5%88%9B%E5%BB%BAtemporary%E4%B8%B4%E6%97%B6%E8%A1%A8\" >\u4f7f\u7528like\u521b\u5efatemporary\u4e34\u65f6\u8868<\/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\/6327\/#%E4%BD%BF%E7%94%A8create_as_%E5%88%9B%E5%BB%BA%E7%BB%93%E6%9E%9C%E9%9B%86%E7%9A%84temporary%E8%A1%A8\" >\u4f7f\u7528create as \u521b\u5efa\u7ed3\u679c\u96c6\u7684temporary\u8868<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.gbase8.cn\/en\/6327\/#%E5%88%9B%E5%BB%BA%E5%BC%95%E8%B5%B7%E6%B7%B7%E6%B7%86%E7%9A%84%E5%92%8C%E7%89%A9%E7%90%86%E8%A1%A8%E7%9B%B8%E5%90%8C%E5%90%8D%E5%AD%97%E7%9A%84temporary%E4%B8%B4%E6%97%B6%E8%A1%A8\" >\u521b\u5efa\u5f15\u8d77\u6df7\u6dc6\u7684\u548c\u7269\u7406\u8868\u76f8\u540c\u540d\u5b57\u7684temporary\u4e34\u65f6\u8868<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.gbase8.cn\/en\/6327\/#%E6%95%B0%E6%8D%AE%E5%BA%93%E5%86%85%E9%83%A8%E5%AE%9E%E7%8E%B0\" >\u6570\u636e\u5e93\u5185\u90e8\u5b9e\u73b0<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E4%B8%B4%E6%97%B6%E8%A1%A8%E8%AF%AD%E6%B3%95\"><\/span>\u4e34\u65f6\u8868\u8bed\u6cd5<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>create temporary table TABLE_NAME \u8868\u5b9a\u4e49\ncreate temporary table TABLE_NAME like \u53e6\u4e00\u4e2a\u8868\ncreate temporary table TABLE_NAME as select \u3002\u3002\u3002<\/code><\/pre>\n\n\n\n<p>\u5176\u4e2dTABLE_NAME\u662f\u4e34\u65f6\u8868\u540d\u5b57\u3002<\/p>\n\n\n\n<p><strong><span class=\"has-inline-color has-luminous-vivid-orange-color\">\u6ce8\u610f\uff0c\u8bf7\u4e00\u5b9a\u907f\u514d\u548c\u7269\u7406\u8868\u91cd\u5408\uff0c\u5426\u5219\u867d\u7136\u770b\u4e0a\u53bb\u540d\u5b57\u76f8\u540c\uff0c\u4f46\u4e34\u65f6\u8868\u7684\u4f18\u5148\u7ea7\u6bd4\u7269\u7406\u8868\u9ad8\uff0c\u4f1a\u5bfc\u81f4\u4e0d\u53ef\u9884\u671f\u7684\u7ed3\u679c<\/span><\/strong>\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%A0%B7%E4%BE%8B\"><\/span>\u6837\u4f8b<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u4e34\u65f6\u8868\u662f\u53ef\u4ee5\u6b63\u5e38\u52a0\u8f7d\u7684\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%88%9B%E5%BB%BA%E6%99%AE%E9%80%9A%E4%B8%B4%E6%97%B6%E8%A1%A8\"><\/span>\u521b\u5efa\u666e\u901a\u4e34\u65f6\u8868<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase> create temporary table tmp_v1 (id int, name varchar(100));\r\nQuery OK, 0 rows affected (Elapsed: 00:00:00.26)\r\n\r\ngbase> load data infile 'sftp:\/\/gbase:gbase1234@10.0.2.201\/home\/gbase\/t1.txt' into table tmp_v1;\r\nQuery OK, 0 rows affected (Elapsed: 00:00:13.49)\r\nTask 5111818 finished, Loaded 1000001 records, Skipped 0 records\r\n\r\ngbase> show create table tmp_v1;\r\n+--------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n| Table  | Create Table                                                                                                                                                        |\r\n+--------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n| tmp_v1 | CREATE TEMPORARY TABLE \"tmp_v1\" (\r\n  \"id\" int(11) DEFAULT NULL,\r\n  \"name\" varchar(100) DEFAULT NULL\r\n) ENGINE=EXPRESS DEFAULT CHARSET=utf8 TABLESPACE='sys_tablespace' |\r\n+--------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n1 row in set (Elapsed: 00:00:00.00)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E4%BD%BF%E7%94%A8like%E5%88%9B%E5%BB%BAtemporary%E4%B8%B4%E6%97%B6%E8%A1%A8\"><\/span>\u4f7f\u7528like\u521b\u5efatemporary\u4e34\u65f6\u8868<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase> create temporary table tmp_zxq1 like tt;\r\nQuery OK, 0 rows affected (Elapsed: 00:00:00.33)\r\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E4%BD%BF%E7%94%A8create_as_%E5%88%9B%E5%BB%BA%E7%BB%93%E6%9E%9C%E9%9B%86%E7%9A%84temporary%E8%A1%A8\"><\/span>\u4f7f\u7528create as \u521b\u5efa\u7ed3\u679c\u96c6\u7684temporary\u8868<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase> create temporary table tmp_zxq2 as select * from t1 limit 10;\r\nQuery OK, 10 rows affected (Elapsed: 00:00:00.40)\r\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%88%9B%E5%BB%BA%E5%BC%95%E8%B5%B7%E6%B7%B7%E6%B7%86%E7%9A%84%E5%92%8C%E7%89%A9%E7%90%86%E8%A1%A8%E7%9B%B8%E5%90%8C%E5%90%8D%E5%AD%97%E7%9A%84temporary%E4%B8%B4%E6%97%B6%E8%A1%A8\"><\/span>\u521b\u5efa\u5f15\u8d77\u6df7\u6dc6\u7684\u548c\u7269\u7406\u8868\u76f8\u540c\u540d\u5b57\u7684temporary\u4e34\u65f6\u8868<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u539f\u59cb\u8868t1\u670910001\u884c\uff0c\u521b\u5efa\u7684t1\u4e34\u65f6\u8868\u53ea\u670910\u884c\u3002\u540e\u9762t1\u5230\u5e95\u662f\u54ea\u4e2a\uff1f \u4e34\u65f6\u8868\u4f18\u5148\uff0c\u4f1a\u5f15\u8d77\u7ed3\u679c\u96c6\u4e0d\u7b26\u5408\u9884\u671f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase> create temporary table t1 as select * from t1 limit 10;\r\nQuery OK, 10 rows affected (Elapsed: 00:00:00.40)\r\n\r\ngbase> show create table t1;\r\n+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n| Table | Create Table                                                                                                                                                    |\r\n+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n| t1    | CREATE TEMPORARY TABLE \"t1\" (\r\n  \"id\" int(11) DEFAULT NULL,\r\n  \"name\" varchar(100) DEFAULT NULL\r\n) ENGINE=EXPRESS DEFAULT CHARSET=utf8 TABLESPACE='sys_tablespace' |\r\n+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+\r\n1 row in set (Elapsed: 00:00:00.00)\r\n\r\ngbase> select count(*) from t1;\r\n+----------+\r\n| count(*) |\r\n+----------+\r\n|       10 |\r\n+----------+\r\n1 row in set (Elapsed: 00:00:00.01)\r\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%95%B0%E6%8D%AE%E5%BA%93%E5%86%85%E9%83%A8%E5%AE%9E%E7%8E%B0\"><\/span>\u6570\u636e\u5e93\u5185\u90e8\u5b9e\u73b0<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u6570\u636e\u5e93\u662f\u5728gclusterdb\u5e93\u4e0b\u9762\u521b\u5efa\u5982\u4e0b\u547d\u540d\u7684\u8868\uff0c\u6765\u5b9e\u73b0temporary\u7684\u4e34\u65f6\u8868\u7684\uff0c\u901a\u8fc7nodeid\u548csessionid \u5df2\u7ecf\u521b\u5efa\u4e34\u65f6\u8868\u7684\u9012\u589e\u987a\u5e8f\uff0c\u907f\u514d\u4e86\u4e34\u65f6\u8868\u7684\u91cd\u590d\u73b0\u8c61\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>gcs\u662f\u4e34\u65f6\u8868<\/li><li>3372351498 \u662f\u8c03\u5ea6\u8282\u70b9\u7684nodeid<\/li><li>24 \u662f\u8fde\u63a5\u7684session id<\/li><li>0,1,2,3,4,5 \u662f\u521b\u5efa\u7684\u7b2c\u51e0\u4e2a\u3002<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase> show tables like 'gcs%';\r\n+-----------------------------+\r\n| Tables_in_gclusterdb (gcs%) |\r\n+-----------------------------+\r\n| gcs_3372351498_24_0         |\r\n| gcs_3372351498_24_1         |\r\n| gcs_3372351498_24_3         |\r\n| gcs_3372351498_24_4         |\r\n| gcs_3372351498_24_5         |\r\n+-----------------------------+\r\n5 rows in set (Elapsed: 00:00:00.00)\r\n<\/code><\/pre>","protected":false},"excerpt":{"rendered":"<p>\u5357\u5927\u901a\u7528GBase 8a\u652f\u6301\u521b\u5efaTemporary\u8868\uff0c\u5141\u8bb8\u4e0d\u540c\u7684session\u4f7f\u7528\u76f8\u540c\u7684\u4e34\u65f6\u8868\u540d\u5b57\u800c\u4e0d\u4f1a\u51b2\u7a81\u3002\u8fd9\u4e9b\u8868\u5728session\u5173\u95ed\u65f6\u4f1a\u81ea\u52a8\u9500\u6bc1\u3002\u4f46\u5982\u679c\u4f7f\u7528\u4e86\u8fde\u63a5\u6c60\uff0c\u8fd8\u662f\u4f1a\u6709\u51b2\u7a81\uff0c\u6240\u4ee5\u8fd8\u662f\u5efa\u8bae\u7528\u6237\u81ea\u884c\u9500\u6bc1\u4e34\u65f6\u8868\u3002\u6216\u8005\u5728\u4f7f\u7528\u524d\u5220\u9664\u53ef\u80fd\u5b58\u5728\u7684\u4e34\u65f6\u8868\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-6327","post","type-post","status-publish","format-standard","hentry","category-gbase8a"],"_links":{"self":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/6327","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=6327"}],"version-history":[{"count":2,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/6327\/revisions"}],"predecessor-version":[{"id":6329,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/6327\/revisions\/6329"}],"wp:attachment":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/media?parent=6327"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/categories?post=6327"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/tags?post=6327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}