{"id":1842,"date":"2020-10-27T16:26:59","date_gmt":"2020-10-27T08:26:59","guid":{"rendered":"https:\/\/www.gbase8.cn\/?p=1842"},"modified":"2020-10-27T16:26:59","modified_gmt":"2020-10-27T08:26:59","slug":"gbase-8a%e5%a4%a7%e9%87%8f%e5%8d%95%e6%9d%a1update%e7%9a%84%e6%89%b9%e9%87%8f%e4%bc%98%e5%8c%96%e6%96%b9%e6%a1%88","status":"publish","type":"post","link":"https:\/\/www.gbase8.cn\/en\/1842","title":{"rendered":"\u5357\u5927\u901a\u7528GBase 8a\u5927\u91cf\u5355\u6761update\u7684\u6279\u91cf\u4f18\u5316\u65b9\u6848"},"content":{"rendered":"<p>\u5f53\u6709\u5927\u91cf\u7684\u5355\u6761update\u65f6\uff0c\u672c\u6587\u4ecb\u7ecd\u51e0\u79cd\u4f18\u5316\u65b9\u6848\u6765\u63d0\u5347\u6027\u80fd\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-6a2b1f5314acf\" 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-6a2b1f5314acf\"  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\/1842\/#%E5%8D%95%E6%9D%A1update%E5%9C%BA%E6%99%AF\" >\u5355\u6761update\u573a\u666f<\/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\/1842\/#%E6%89%B9%E9%87%8F%E6%9B%B4%E6%96%B0%E6%9C%89%E8%A7%84%E5%BE%8B%E7%9A%84%E5%80%BC\" >\u6279\u91cf\u66f4\u65b0\u6709\u89c4\u5f8b\u7684\u503c<\/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\/1842\/#%E6%89%B9%E9%87%8F%E6%9B%B4%E6%96%B0%E6%97%A0%E8%A7%84%E5%BE%8B%E7%9A%84%E5%80%BC\" >\u6279\u91cf\u66f4\u65b0\u65e0\u89c4\u5f8b\u7684\u503c<\/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\/1842\/#%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=\"%E5%8D%95%E6%9D%A1update%E5%9C%BA%E6%99%AF\"><\/span>\u5355\u6761update\u573a\u666f<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u6bd4\u5982\u4e0d\u540c\u7684id,\u8981\u66f4\u65b0\u6210\u4e00\u4e2a\u65b0\u7684\u6570\u503c\uff0c\u4e14\u6570\u91cf\u5f88\u591a\uff0c\u6bd4\u5982\uff0c\u51e0\u767e\uff0c\u51e0\u4e07\u751a\u81f3\u66f4\u591a\u3002\u5982\u679c\u91c7\u7528\u9010\u884c\u7684\u65b9\u6848\uff0c\u5219gbase\u6bcf\u6b21update\u90fd\u8981\u505a\u6570\u636e\u5e93\u5185\u90e8\u7684\u7248\u672c\u5207\u6362\uff0c\u5176\u6027\u80fd\u662f\u975e\u5e38\u5dee\u7684\u3002\u666e\u901a\u76841\u79d2\u80fd\u6267\u884c2-3\u884c\u5c31\u5f88\u597d\u4e86\u3002<\/p>\n\n\n\n<p>\u5982\u4e0b\u6700\u7b80\u5355\u7684\u573a\u666f\uff0c\u6bcf\u6b21\u4e00\u4e2a\u6761\u4ef6\uff0c\u5927\u7ea6\u66f4\u65b020-40\u884c\u8bb0\u5f55\uff0c\u9700\u89810.5\u79d2\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase> desc t1;\n+-------+--------------+------+-----+---------+-------+\n| Field | Type         | Null | Key | Default | Extra |\n+-------+--------------+------+-----+---------+-------+\n| id    | int(11)      | YES  |     | NULL    |       |\n| name  | varchar(100) | YES  |     | NULL    |       |\n+-------+--------------+------+-----+---------+-------+\n2 rows in set (Elapsed: 00:00:00.00)\n\ngbase> select count(*) from t1;\n+----------+\n| count(*) |\n+----------+\n|  1000001 |\n+----------+\n1 row in set (Elapsed: 00:00:00.01)\n\n\ngbase> update t1 set name=concat('NAME',id) where id=856;\nQuery OK, 28 rows affected (Elapsed: 00:00:00.62)\nRows matched: 28  Changed: 28  Warnings: 0\n\ngbase> update t1 set name=concat('NAME',id) where id=857;\nQuery OK, 29 rows affected (Elapsed: 00:00:00.63)\nRows matched: 29  Changed: 29  Warnings: 0\n\ngbase> update t1 set name=concat('NAME',id) where id=858;\nQuery OK, 37 rows affected (Elapsed: 00:00:00.52)\nRows matched: 37  Changed: 37  Warnings: 0<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%89%B9%E9%87%8F%E6%9B%B4%E6%96%B0%E6%9C%89%E8%A7%84%E5%BE%8B%E7%9A%84%E5%80%BC\"><\/span>\u6279\u91cf\u66f4\u65b0\u6709\u89c4\u5f8b\u7684\u503c<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u5982\u679c\u6570\u503c\u548c\u5176\u5b83\u5b57\u6bb5\u6709\u8ba1\u7b97\u5173\u7cfb\uff0c\u53ef\u4ee5\u4e00\u6b21\u6027\u66f4\u65b0\u591a\u884c\uff0c\u5c06\u6761\u4ef6\u7528in\u6216\u5b50\u67e5\u8be2\u7684\u5f62\u5f0f\u505a\u8fc7\u6ee4\u6761\u4ef6\uff0c\u907f\u514d\u4e00\u884c\u4e00\u884c\u7684\u64cd\u4f5c\u3002<\/p>\n\n\n\n<p>\u5982\u4e0b\u901a\u8fc7in\u4e00\u6b21\u6027\u66f4\u65b03\u4e2aip,\u5176\u6027\u80fd\u548c\u5355\u4e2a\u7684\u76f8\u5f53\uff0c\u7b49\u540c\u4e8e\u63d0\u5347\u4e863\u500d\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase> update t1 set name=concat('NAME',id) where id in(856,857,858);\nQuery OK, 94 rows affected (Elapsed: 00:00:00.48)\nRows matched: 94  Changed: 94  Warnings: 0\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%89%B9%E9%87%8F%E6%9B%B4%E6%96%B0%E6%97%A0%E8%A7%84%E5%BE%8B%E7%9A%84%E5%80%BC\"><\/span>\u6279\u91cf\u66f4\u65b0\u65e0\u89c4\u5f8b\u7684\u503c<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u6570\u503c\u662f\u901a\u8fc7\u67d0\u4e9b\u7b97\u6cd5\u5f97\u5230\u7684\uff0c\u6bd4\u5982\u4f59\u989d\uff0c\u5176\u6570\u503c\u65e0\u6cd5\u89c4\u5f8b\u6027\u7684\u5f97\u5230\uff0c\u5219\u5efa\u8bae\u5148\u5efa\u7acb\u4e00\u4e2a\u4e34\u65f6\u8868\uff0c\u5c06\u8981\u66f4\u65b0\u7684id\u548c\u503c\u4fdd\u5b58\u5230\u8fd9\u4e2a\u4e34\u65f6\u8868\u91cc\uff0c\u5efa\u8bae\u7528\u590d\u5236\u8868\u3002\u7136\u540e\u901a\u8fc7\u5173\u8054\u66f4\u65b0\u6765\u4e00\u6b21\u6027\u66f4\u65b0\u6240\u6709\u7684\u503c\u3002<\/p>\n\n\n\n<p>\u5982\u4e0b\u901a\u8fc7\u4e34\u65f6\u8868\u6765\u5173\u8054\u66f4\u65b0\uff0c\u867d\u7136insert\u65f6\u6d6a\u8d39\u4e86\u4e00\u4e9b\u65f6\u95f4\uff0c\u4f46\u6574\u4f53\u4e0a\u66f4\u65b03\u884c\u8017\u65f61.6\u79d2 (0.42+0.27+1.01)\uff0c \u4e5f\u57fa\u672c\u548c\u9010\u884c\u76f8\u5f53\uff0c\u4f46\u5982\u679c\u4e00\u6b21\u66f4\u65b01000\u4e2a\uff0c\u5176update\u7684\u8017\u65f6\u5e76\u6ca1\u6709\u6210\u6bd4\u4f8b\u589e\u52a0\uff0c\u6700\u7ec8\u6bd4\u9010\u6761\u63d0\u5347\u4e86\u63a5\u8fd11000\u500d\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase> create table tmpab(id int, name varchar(100));\nQuery OK, 0 rows affected (Elapsed: 00:00:00.42)\ngbase> insert into tmpab values(856,'I AM A 856'),(857,'I AM B 857'),(858,'I AM C 858');\nQuery OK, 3 rows affected (Elapsed: 00:00:00.27)\nRecords: 3  Duplicates: 0  Warnings: 0\n\ngbase> select distinct * from t1 where id in (856,857,858);\n+------+---------+\n| id   | name    |\n+------+---------+\n|  856 | NAME856 |\n|  857 | NAME857 |\n|  858 | NAME858 |\n+------+---------+\n3 rows in set (Elapsed: 00:00:00.05)\n\ngbase> update t1 ,tmpab set t1.name=tmpab.name where t1.id=tmpab.id;\nQuery OK, 94 rows affected (Elapsed: 00:00:01.01)\nRows matched: 94  Changed: 94  Warnings: 0\n\nbase> select distinct * from t1 where id in (856,857,858);\n+------+------------+\n| id   | name       |\n+------+------------+\n|  856 | I AM A 856 |\n|  857 | I AM B 857 |\n|  858 | I AM C 858 |\n+------+------------+\n3 rows in set (Elapsed: 00:00:00.09)\n\n\n\ngbase> truncate table tmpab;\nQuery OK, 3 rows affected (Elapsed: 00:00:00.38)\n\n\ngbase> insert into tmpab select distinct id,concat('HAHA',id) from t1 limit 1000;\nQuery OK, 1000 rows affected (Elapsed: 00:00:00.34)\nRecords: 1000  Duplicates: 0  Warnings: 0\n\ngbase> update t1 ,tmpab set t1.name=tmpab.name where t1.id=tmpab.id;\nQuery OK, 31513 rows affected (Elapsed: 00:00:00.58)\nRows matched: 31513  Changed: 31513  Warnings: 0\n<\/code><\/pre>\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-wordpress wp-block-embed is-type-wp-embed is-provider-\u8001\u7d2b\u7af9\u7684\u5bb6\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"aDSErd6lok\"><a href=\"https:\/\/www.gbase8.cn\/en\/877\/\">GBase 8a\u6570\u636e\u5e93\u591a\u8868\u5173\u8054\u66f4\u65b0update<\/a><\/blockquote><iframe loading=\"lazy\" title=\"\u300aGBase 8a\u6570\u636e\u5e93\u591a\u8868\u5173\u8054\u66f4\u65b0update\u300b\u2014\u8001\u7d2b\u7af9\u7684\u5bb6\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" src=\"https:\/\/www.gbase8.cn\/877\/embed#?secret=aDSErd6lok\" data-secret=\"aDSErd6lok\" 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\u5927\u91cf\u5355\u6761update\u7684\u6279\u91cf\u4f18\u5316\u65b9\u6848<\/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-1842","post","type-post","status-publish","format-standard","hentry","category-gbase8a"],"_links":{"self":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/1842","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=1842"}],"version-history":[{"count":1,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/1842\/revisions"}],"predecessor-version":[{"id":1843,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/1842\/revisions\/1843"}],"wp:attachment":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/media?parent=1842"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/categories?post=1842"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/tags?post=1842"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}