blob: 6b8ad9d1c9dbdf2690b360199fc41d7d6adce4f2 [file] [log] [blame]
"use strict";(self.webpackChunkdoris_website=self.webpackChunkdoris_website||[]).push([[3053],{15680:(e,n,l)=>{l.d(n,{xA:()=>u,yg:()=>c});var a=l(296540);function t(e,n,l){return n in e?Object.defineProperty(e,n,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[n]=l,e}function r(e,n){var l=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),l.push.apply(l,a)}return l}function i(e){for(var n=1;n<arguments.length;n++){var l=null!=arguments[n]?arguments[n]:{};n%2?r(Object(l),!0).forEach((function(n){t(e,n,l[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):r(Object(l)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(l,n))}))}return e}function o(e,n){if(null==e)return{};var l,a,t=function(e,n){if(null==e)return{};var l,a,t={},r=Object.keys(e);for(a=0;a<r.length;a++)l=r[a],n.indexOf(l)>=0||(t[l]=e[l]);return t}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)l=r[a],n.indexOf(l)>=0||Object.prototype.propertyIsEnumerable.call(e,l)&&(t[l]=e[l])}return t}var p=a.createContext({}),s=function(e){var n=a.useContext(p),l=n;return e&&(l="function"==typeof e?e(n):i(i({},n),e)),l},u=function(e){var n=s(e.components);return a.createElement(p.Provider,{value:n},e.children)},y="mdxType",g={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},m=a.forwardRef((function(e,n){var l=e.components,t=e.mdxType,r=e.originalType,p=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),y=s(l),m=t,c=y["".concat(p,".").concat(m)]||y[m]||g[m]||r;return l?a.createElement(c,i(i({ref:n},u),{},{components:l})):a.createElement(c,i({ref:n},u))}));function c(e,n){var l=arguments,t=n&&n.mdxType;if("string"==typeof e||t){var r=l.length,i=new Array(r);i[0]=m;var o={};for(var p in n)hasOwnProperty.call(n,p)&&(o[p]=n[p]);o.originalType=e,o[y]="string"==typeof e?e:t,i[1]=o;for(var s=2;s<r;s++)i[s]=l[s];return a.createElement.apply(null,i)}return a.createElement.apply(null,l)}m.displayName="MDXCreateElement"},435984:(e,n,l)=>{l.r(n),l.d(n,{assets:()=>p,contentTitle:()=>i,default:()=>g,frontMatter:()=>r,metadata:()=>o,toc:()=>s});var a=l(58168),t=(l(296540),l(15680));const r={title:"\u4f7f\u7528\u6307\u5357",language:"zh-CN"},i=void 0,o={unversionedId:"data-table/basic-usage",id:"version-1.2/data-table/basic-usage",title:"\u4f7f\u7528\u6307\u5357",description:"\x3c!--",source:"@site/i18n/zh-CN/docusaurus-plugin-content-docs/version-1.2/data-table/basic-usage.md",sourceDirName:"data-table",slug:"/data-table/basic-usage",permalink:"/zh-CN/docs/1.2/data-table/basic-usage",draft:!1,tags:[],version:"1.2",frontMatter:{title:"\u4f7f\u7528\u6307\u5357",language:"zh-CN"},sidebar:"docs",previous:{title:"\u6570\u636e\u5212\u5206",permalink:"/zh-CN/docs/1.2/data-table/data-partition"},next:{title:"Rollup\u4e0e\u67e5\u8be2",permalink:"/zh-CN/docs/1.2/data-table/hit-the-rollup"}},p={},s=[{value:"\u521b\u5efa\u7528\u6237",id:"\u521b\u5efa\u7528\u6237",level:2},{value:"Root\u7528\u6237\u767b\u5f55\u4e0e\u5bc6\u7801\u4fee\u6539",id:"root\u7528\u6237\u767b\u5f55\u4e0e\u5bc6\u7801\u4fee\u6539",level:3},{value:"\u521b\u5efa\u65b0\u7528\u6237",id:"\u521b\u5efa\u65b0\u7528\u6237",level:3},{value:"\u6570\u636e\u8868\u7684\u521b\u5efa\u4e0e\u6570\u636e\u5bfc\u5165",id:"\u6570\u636e\u8868\u7684\u521b\u5efa\u4e0e\u6570\u636e\u5bfc\u5165",level:2},{value:"\u521b\u5efa\u6570\u636e\u5e93",id:"\u521b\u5efa\u6570\u636e\u5e93",level:3},{value:"\u8d26\u6237\u6388\u6743",id:"\u8d26\u6237\u6388\u6743",level:3},{value:"\u5efa\u8868",id:"\u5efa\u8868",level:3},{value:"\u5355\u5206\u533a",id:"\u5355\u5206\u533a",level:4},{value:"\u591a\u5206\u533a",id:"\u591a\u5206\u533a",level:4},{value:"\u5bfc\u5165\u6570\u636e",id:"\u5bfc\u5165\u6570\u636e",level:3},{value:"\u6d41\u5f0f\u5bfc\u5165",id:"\u6d41\u5f0f\u5bfc\u5165",level:4},{value:"Broker \u5bfc\u5165",id:"broker-\u5bfc\u5165",level:4},{value:"\u6570\u636e\u7684\u67e5\u8be2",id:"\u6570\u636e\u7684\u67e5\u8be2",level:2},{value:"\u7b80\u5355\u67e5\u8be2",id:"\u7b80\u5355\u67e5\u8be2",level:3},{value:"SELECT * EXCEPT",id:"select--except",level:3},{value:"Join \u67e5\u8be2",id:"join-\u67e5\u8be2",level:3},{value:"\u5b50\u67e5\u8be2",id:"\u5b50\u67e5\u8be2",level:3},{value:"\u8868\u7ed3\u6784\u53d8\u66f4",id:"\u8868\u7ed3\u6784\u53d8\u66f4",level:2},{value:"Rollup",id:"rollup",level:2},{value:"\u7269\u5316\u89c6\u56fe",id:"\u7269\u5316\u89c6\u56fe",level:2},{value:"\u6570\u636e\u8868\u7684\u67e5\u8be2",id:"\u6570\u636e\u8868\u7684\u67e5\u8be2",level:2},{value:"\u5185\u5b58\u9650\u5236",id:"\u5185\u5b58\u9650\u5236",level:3},{value:"\u67e5\u8be2\u8d85\u65f6",id:"\u67e5\u8be2\u8d85\u65f6",level:3},{value:"Broadcast/Shuffle Join",id:"broadcastshuffle-join",level:3},{value:"\u67e5\u8be2\u91cd\u8bd5\u548c\u9ad8\u53ef\u7528",id:"\u67e5\u8be2\u91cd\u8bd5\u548c\u9ad8\u53ef\u7528",level:3},{value:"\u6570\u636e\u66f4\u65b0\u548c\u5220\u9664",id:"\u6570\u636e\u66f4\u65b0\u548c\u5220\u9664",level:2}],u={toc:s},y="wrapper";function g(e){let{components:n,...l}=e;return(0,t.yg)(y,(0,a.A)({},u,l,{components:n,mdxType:"MDXLayout"}),(0,t.yg)("h1",{id:"\u4f7f\u7528\u6307\u5357"},"\u4f7f\u7528\u6307\u5357"),(0,t.yg)("p",null,"Doris \u91c7\u7528 MySQL \u534f\u8bae\u8fdb\u884c\u901a\u4fe1\uff0c\u7528\u6237\u53ef\u901a\u8fc7 MySQL client \u6216\u8005 MySQL JDBC\u8fde\u63a5\u5230 Doris \u96c6\u7fa4\u3002\u9009\u62e9 MySQL client \u7248\u672c\u65f6\u5efa\u8bae\u91c7\u75285.1 \u4e4b\u540e\u7684\u7248\u672c\uff0c\u56e0\u4e3a 5.1 \u4e4b\u524d\u4e0d\u80fd\u652f\u6301\u957f\u5ea6\u8d85\u8fc7 16 \u4e2a\u5b57\u7b26\u7684\u7528\u6237\u540d\u3002\u672c\u6587\u4ee5 MySQL client \u4e3a\u4f8b\uff0c\u901a\u8fc7\u4e00\u4e2a\u5b8c\u6574\u7684\u6d41\u7a0b\u5411\u7528\u6237\u5c55\u793a Doris \u7684\u57fa\u672c\u4f7f\u7528\u65b9\u6cd5\u3002"),(0,t.yg)("h2",{id:"\u521b\u5efa\u7528\u6237"},"\u521b\u5efa\u7528\u6237"),(0,t.yg)("p",null,"\u4e0b\u8f7d\u514d\u5b89\u88c5\u7684 ",(0,t.yg)("a",{parentName:"p",href:"https://doris-build-hk.oss-cn-hongkong.aliyuncs.com/mysql-client/mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz"},"MySQL \u5ba2\u6237\u7aef"),"\u3002"),(0,t.yg)("h3",{id:"root\u7528\u6237\u767b\u5f55\u4e0e\u5bc6\u7801\u4fee\u6539"},"Root\u7528\u6237\u767b\u5f55\u4e0e\u5bc6\u7801\u4fee\u6539"),(0,t.yg)("p",null,"Doris \u5185\u7f6e root\uff0c\u5bc6\u7801\u9ed8\u8ba4\u4e3a\u7a7a\u3002"),(0,t.yg)("blockquote",null,(0,t.yg)("p",{parentName:"blockquote"},"\u5907\u6ce8\uff1a"),(0,t.yg)("p",{parentName:"blockquote"},"Doris \u63d0\u4f9b\u7684\u9ed8\u8ba4 root "),(0,t.yg)("p",{parentName:"blockquote"},"root \u7528\u6237\u9ed8\u8ba4\u62e5\u6709\u96c6\u7fa4\u6240\u6709\u6743\u9650\u3002\u540c\u65f6\u62e5\u6709 Grant_priv \u548c Node_priv \u7684\u7528\u6237\uff0c\u53ef\u4ee5\u5c06\u8be5\u6743\u9650\u8d4b\u4e88\u5176\u4ed6\u7528\u6237\uff0c\u62e5\u6709\u8282\u70b9\u53d8\u66f4\u6743\u9650\uff0c\u5305\u62ec FE\u3001BE\u3001BROKER \u8282\u70b9\u7684\u6dfb\u52a0\u3001\u5220\u9664\u3001\u4e0b\u7ebf\u7b49\u64cd\u4f5c\u3002"),(0,t.yg)("p",{parentName:"blockquote"},"\u5173\u4e8e\u6743\u9650\u8fd9\u5757\u7684\u5177\u4f53\u8bf4\u660e\u53ef\u4ee5\u53c2\u7167",(0,t.yg)("a",{parentName:"p",href:"/zh-CN/docs/1.2/admin-manual/privilege-ldap/user-privilege"},"\u6743\u9650\u7ba1\u7406"))),(0,t.yg)("p",null,"\u542f\u52a8\u5b8c Doris \u7a0b\u5e8f\u4e4b\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7 root \u6216 admin \u7528\u6237\u8fde\u63a5\u5230 Doris \u96c6\u7fa4\u3002 \u4f7f\u7528\u4e0b\u9762\u547d\u4ee4\u5373\u53ef\u767b\u5f55 Doris\uff0c\u767b\u5f55\u540e\u8fdb\u5165\u5230Doris\u5bf9\u5e94\u7684Mysql\u547d\u4ee4\u884c\u64cd\u4f5c\u754c\u9762\uff1a"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-bash"},"[root@doris ~]# mysql -h FE_HOST -P9030 -uroot\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 41\nServer version: 5.1.0 Doris version 1.0.0-preview2-b48ee2734\n\nCopyright (c) 2000, 2022, Oracle and/or its affiliates.\n\nOracle is a registered trademark of Oracle Corporation and/or its\naffiliates. Other names may be trademarks of their respective\nowners.\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\n\nmysql> \n")),(0,t.yg)("blockquote",null,(0,t.yg)("p",{parentName:"blockquote"},(0,t.yg)("inlineCode",{parentName:"p"},"FE_HOST")," \u662f\u4efb\u4e00FE\u8282\u70b9\u7684IP\u5730\u5740\uff0c",(0,t.yg)("inlineCode",{parentName:"p"},"9030")," \u662ffe.conf \u4e2d\u7684 query_port \u914d\u7f6e\uff1b")),(0,t.yg)("p",null,"\u767b\u5f55\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u4fee\u6539root\u5bc6\u7801\uff1a"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-mysql"},"mysql> SET PASSWORD FOR 'root' = PASSWORD('your_password');\nQuery OK, 0 rows affected (0.00 sec)\n")),(0,t.yg)("blockquote",null,(0,t.yg)("p",{parentName:"blockquote"},(0,t.yg)("inlineCode",{parentName:"p"},"your_password"),"\u662f\u4e3a",(0,t.yg)("inlineCode",{parentName:"p"},"root"),"\u7528\u6237\u8bbe\u7f6e\u7684\u65b0\u5bc6\u7801\uff0c\u53ef\u4ee5\u968f\u610f\u8bbe\u7f6e\uff0c\u5efa\u8bae\u8bbe\u7f6e\u4e3a\u5f3a\u5bc6\u7801\u589e\u52a0\u5b89\u5168\u6027\uff0c\u4e0b\u6b21\u767b\u5f55\u5c31\u7528\u65b0\u5bc6\u7801\u767b\u5f55\u3002")),(0,t.yg)("h3",{id:"\u521b\u5efa\u65b0\u7528\u6237"},"\u521b\u5efa\u65b0\u7528\u6237"),(0,t.yg)("p",null,"\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u7684\u547d\u4ee4\u521b\u5efa\u4e00\u4e2a\u666e\u901a\u7528\u6237",(0,t.yg)("inlineCode",{parentName:"p"},"test"),"\uff1a"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-bash"},"mysql> CREATE USER 'test' IDENTIFIED BY 'test_passwd';\nQuery OK, 0 rows affected (0.00 sec)\n")),(0,t.yg)("p",null,"\u540e\u7eed\u767b\u5f55\u65f6\u5c31\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u94fe\u63a5\u547d\u4ee4\u767b\u5f55\uff1a"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-bash"},"[root@doris ~]# mysql -h FE_HOST -P9030 -utest -ptest_passwd\n")),(0,t.yg)("blockquote",null,(0,t.yg)("p",{parentName:"blockquote"},"\u6ce8\u610f\uff1a\u65b0\u521b\u5efa\u7684\u666e\u901a\u7528\u6237\u9ed8\u8ba4\u6ca1\u6709\u4efb\u4f55\u6743\u9650\uff0c\u6743\u9650\u6388\u4e88\u53ef\u4ee5\u53c2\u8003\u540e\u9762\u7684\u6743\u9650\u6388\u4e88\u3002")),(0,t.yg)("h2",{id:"\u6570\u636e\u8868\u7684\u521b\u5efa\u4e0e\u6570\u636e\u5bfc\u5165"},"\u6570\u636e\u8868\u7684\u521b\u5efa\u4e0e\u6570\u636e\u5bfc\u5165"),(0,t.yg)("h3",{id:"\u521b\u5efa\u6570\u636e\u5e93"},"\u521b\u5efa\u6570\u636e\u5e93"),(0,t.yg)("p",null,"\u521d\u59cb\u53ef\u4ee5\u901a\u8fc7 root \u6216 admin \u7528\u6237\u521b\u5efa\u6570\u636e\u5e93\uff1a"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"CREATE DATABASE example_db;\n")),(0,t.yg)("blockquote",null,(0,t.yg)("p",{parentName:"blockquote"},"\u6240\u6709\u547d\u4ee4\u90fd\u53ef\u4ee5\u4f7f\u7528 ",(0,t.yg)("inlineCode",{parentName:"p"},"HELP command;")," \u67e5\u770b\u5230\u8be6\u7ec6\u7684\u8bed\u6cd5\u5e2e\u52a9\uff0c\u5982\uff1a",(0,t.yg)("inlineCode",{parentName:"p"},"HELP CREATE DATABASE;"),"\u3002\u4e5f\u53ef\u4ee5\u67e5\u9605\u5b98\u7f51 ",(0,t.yg)("a",{parentName:"p",href:"/zh-CN/docs/1.2/sql-manual/sql-reference/Show-Statements/SHOW-CREATE-DATABASE"},"SHOW CREATE DATABASE")," \u547d\u4ee4\u624b\u518c\u3002"),(0,t.yg)("p",{parentName:"blockquote"},"\u5982\u679c\u4e0d\u6e05\u695a\u547d\u4ee4\u7684\u5168\u540d\uff0c\u53ef\u4ee5\u4f7f\u7528 \"help \u547d\u4ee4\u67d0\u4e00\u5b57\u6bb5\" \u8fdb\u884c\u6a21\u7cca\u67e5\u8be2\u3002\u5982\u952e\u5165 'HELP CREATE'\uff0c\u53ef\u4ee5\u5339\u914d\u5230 ",(0,t.yg)("inlineCode",{parentName:"p"},"CREATE DATABASE"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"CREATE TABLE"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"CREATE USER")," \u7b49\u547d\u4ee4\u3002"),(0,t.yg)("pre",{parentName:"blockquote"},(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"mysql> HELP CREATE;\nMany help items for your request exist.\nTo make a more specific request, please type 'help <item>',\nwhere <item> is one of the following\ntopics:\n CREATE CLUSTER\n CREATE DATABASE\n CREATE ENCRYPTKEY\n CREATE FILE\n CREATE FUNCTION\n CREATE INDEX\n CREATE MATERIALIZED VIEW\n CREATE REPOSITORY\n CREATE RESOURCE\n CREATE ROLE\n CREATE SYNC JOB\n CREATE TABLE\n CREATE USER\n CREATE VIEW\n ROUTINE LOAD\n SHOW CREATE FUNCTION\n SHOW CREATE ROUTINE LOAD\n"))),(0,t.yg)("p",null,"\u6570\u636e\u5e93\u521b\u5efa\u5b8c\u6210\u4e4b\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7 ",(0,t.yg)("a",{parentName:"p",href:"/zh-CN/docs/1.2/sql-manual/sql-reference/Show-Statements/SHOW-DATABASES"},"SHOW DATABASES")," \u67e5\u770b\u6570\u636e\u5e93\u4fe1\u606f\u3002"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"mysql> SHOW DATABASES;\n+--------------------+\n| Database |\n+--------------------+\n| example_db |\n| information_schema |\n+--------------------+\n2 rows in set (0.00 sec)\n")),(0,t.yg)("blockquote",null,(0,t.yg)("p",{parentName:"blockquote"},"information_schema\u6570\u636e\u5e93\u662f\u4e3a\u4e86\u517c\u5bb9MySQL\u534f\u8bae\u800c\u5b58\u5728\uff0c\u5b9e\u9645\u4e2d\u4fe1\u606f\u53ef\u80fd\u4e0d\u662f\u5f88\u51c6\u786e\uff0c\u6240\u4ee5\u5173\u4e8e\u5177\u4f53\u6570\u636e\u5e93\u7684\u4fe1\u606f\u5efa\u8bae\u901a\u8fc7\u76f4\u63a5\u67e5\u8be2\u76f8\u5e94\u6570\u636e\u5e93\u800c\u83b7\u5f97\u3002")),(0,t.yg)("h3",{id:"\u8d26\u6237\u6388\u6743"},"\u8d26\u6237\u6388\u6743"),(0,t.yg)("p",null,"example_db \u521b\u5efa\u5b8c\u6210\u4e4b\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7 root/admin \u8d26\u6237\u4f7f\u7528",(0,t.yg)("a",{parentName:"p",href:"/zh-CN/docs/1.2/sql-manual/sql-reference/Account-Management-Statements/GRANT"},"GRANT"),"\u547d\u4ee4\u5c06 example_db \u8bfb\u5199\u6743\u9650\u6388\u6743\u7ed9\u666e\u901a\u8d26\u6237\uff0c\u5982 test\u3002\u6388\u6743\u4e4b\u540e\u91c7\u7528 test \u8d26\u6237\u767b\u5f55\u5c31\u53ef\u4ee5\u64cd\u4f5c example_db \u6570\u636e\u5e93\u4e86\u3002"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"mysql> GRANT ALL ON example_db TO test;\nQuery OK, 0 rows affected (0.01 sec)\n")),(0,t.yg)("h3",{id:"\u5efa\u8868"},"\u5efa\u8868"),(0,t.yg)("p",null,"\u4f7f\u7528 ",(0,t.yg)("a",{parentName:"p",href:"/zh-CN/docs/1.2/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE"},"CREATE TABLE")," \u547d\u4ee4\u5efa\u7acb\u4e00\u4e2a\u8868(Table)\u3002\u66f4\u591a\u8be6\u7ec6\u53c2\u6570\u53ef\u4ee5 ",(0,t.yg)("inlineCode",{parentName:"p"},"HELP CREATE TABLE;"),"\t\t"),(0,t.yg)("p",null,"\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u4f7f\u7528",(0,t.yg)("a",{parentName:"p",href:"/zh-CN/docs/1.2/sql-manual/sql-reference/Utility-Statements/USE"},"USE"),"\u547d\u4ee4\u6765\u5207\u6362\u6570\u636e\u5e93\uff1a"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"mysql> USE example_db;\nDatabase changed\n")),(0,t.yg)("p",null,"Doris\u652f\u6301",(0,t.yg)("a",{parentName:"p",href:"/zh-CN/docs/1.2/data-table/data-partition"},"\u590d\u5408\u5206\u533a\u548c\u5355\u5206\u533a"),"\u4e24\u79cd\u5efa\u8868\u65b9\u5f0f\u3002\u4e0b\u9762\u4ee5\u805a\u5408\u6a21\u578b\u4e3a\u4f8b\uff0c\u5206\u522b\u6f14\u793a\u5982\u4f55\u521b\u5efa\u4e24\u79cd\u5206\u533a\u7684\u6570\u636e\u8868\u3002"),(0,t.yg)("h4",{id:"\u5355\u5206\u533a"},"\u5355\u5206\u533a"),(0,t.yg)("p",null,"\u5efa\u7acb\u4e00\u4e2a\u540d\u5b57\u4e3a table1 \u7684\u903b\u8f91\u8868\u3002\u5206\u6876\u5217\u4e3a siteid\uff0c\u6876\u6570\u4e3a 10\u3002"),(0,t.yg)("p",null,"\u8fd9\u4e2a\u8868\u7684 schema \u5982\u4e0b\uff1a"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},"siteid\uff1a\u7c7b\u578b\u662fINT\uff084\u5b57\u8282\uff09, \u9ed8\u8ba4\u503c\u4e3a10"),(0,t.yg)("li",{parentName:"ul"},"citycode\uff1a\u7c7b\u578b\u662fSMALLINT\uff082\u5b57\u8282\uff09"),(0,t.yg)("li",{parentName:"ul"},"username\uff1a\u7c7b\u578b\u662fVARCHAR, \u6700\u5927\u957f\u5ea6\u4e3a32, \u9ed8\u8ba4\u503c\u4e3a\u7a7a\u5b57\u7b26\u4e32"),(0,t.yg)("li",{parentName:"ul"},"pv\uff1a\u7c7b\u578b\u662fBIGINT\uff088\u5b57\u8282\uff09, \u9ed8\u8ba4\u503c\u662f0; \u8fd9\u662f\u4e00\u4e2a\u6307\u6807\u5217, Doris\u5185\u90e8\u4f1a\u5bf9\u6307\u6807\u5217\u505a\u805a\u5408\u64cd\u4f5c, \u8fd9\u4e2a\u5217\u7684\u805a\u5408\u65b9\u6cd5\u662f\u6c42\u548c\uff08SUM\uff09")),(0,t.yg)("p",null,"\u5efa\u8868\u8bed\u53e5\u5982\u4e0b\uff1a"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"CREATE TABLE table1\n(\n siteid INT DEFAULT '10',\n citycode SMALLINT,\n username VARCHAR(32) DEFAULT '',\n pv BIGINT SUM DEFAULT '0'\n)\nAGGREGATE KEY(siteid, citycode, username)\nDISTRIBUTED BY HASH(siteid) BUCKETS 10\nPROPERTIES(\"replication_num\" = \"1\");\n")),(0,t.yg)("h4",{id:"\u591a\u5206\u533a"},"\u591a\u5206\u533a"),(0,t.yg)("p",null,"\u5efa\u7acb\u4e00\u4e2a\u540d\u5b57\u4e3a table2 \u7684\u903b\u8f91\u8868\u3002"),(0,t.yg)("p",null,"\u8fd9\u4e2a\u8868\u7684 schema \u5982\u4e0b\uff1a"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},"event_day\uff1a\u7c7b\u578b\u662fDATE\uff0c\u65e0\u9ed8\u8ba4\u503c"),(0,t.yg)("li",{parentName:"ul"},"siteid\uff1a\u7c7b\u578b\u662fINT\uff084\u5b57\u8282\uff09, \u9ed8\u8ba4\u503c\u4e3a10"),(0,t.yg)("li",{parentName:"ul"},"citycode\uff1a\u7c7b\u578b\u662fSMALLINT\uff082\u5b57\u8282\uff09"),(0,t.yg)("li",{parentName:"ul"},"username\uff1a\u7c7b\u578b\u662fVARCHAR, \u6700\u5927\u957f\u5ea6\u4e3a32, \u9ed8\u8ba4\u503c\u4e3a\u7a7a\u5b57\u7b26\u4e32"),(0,t.yg)("li",{parentName:"ul"},"pv\uff1a\u7c7b\u578b\u662fBIGINT\uff088\u5b57\u8282\uff09, \u9ed8\u8ba4\u503c\u662f0; \u8fd9\u662f\u4e00\u4e2a\u6307\u6807\u5217, Doris \u5185\u90e8\u4f1a\u5bf9\u6307\u6807\u5217\u505a\u805a\u5408\u64cd\u4f5c, \u8fd9\u4e2a\u5217\u7684\u805a\u5408\u65b9\u6cd5\u662f\u6c42\u548c\uff08SUM\uff09")),(0,t.yg)("p",null,"\u6211\u4eec\u4f7f\u7528 event_day \u5217\u4f5c\u4e3a\u5206\u533a\u5217\uff0c\u5efa\u7acb3\u4e2a\u5206\u533a: p201706, p201707, p201708"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},"p201706\uff1a\u8303\u56f4\u4e3a [\u6700\u5c0f\u503c, 2017-07-01)"),(0,t.yg)("li",{parentName:"ul"},"p201707\uff1a\u8303\u56f4\u4e3a [2017-07-01, 2017-08-01)"),(0,t.yg)("li",{parentName:"ul"},"p201708\uff1a\u8303\u56f4\u4e3a [2017-08-01, 2017-09-01)")),(0,t.yg)("blockquote",null,(0,t.yg)("p",{parentName:"blockquote"},"\u6ce8\u610f\u533a\u95f4\u4e3a\u5de6\u95ed\u53f3\u5f00\u3002")),(0,t.yg)("p",null,"\u6bcf\u4e2a\u5206\u533a\u4f7f\u7528 siteid \u8fdb\u884c\u54c8\u5e0c\u5206\u6876\uff0c\u6876\u6570\u4e3a10"),(0,t.yg)("p",null,"\u5efa\u8868\u8bed\u53e5\u5982\u4e0b:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"CREATE TABLE table2\n(\n event_day DATE,\n siteid INT DEFAULT '10',\n citycode SMALLINT,\n username VARCHAR(32) DEFAULT '',\n pv BIGINT SUM DEFAULT '0'\n)\nAGGREGATE KEY(event_day, siteid, citycode, username)\nPARTITION BY RANGE(event_day)\n(\n PARTITION p201706 VALUES LESS THAN ('2017-07-01'),\n PARTITION p201707 VALUES LESS THAN ('2017-08-01'),\n PARTITION p201708 VALUES LESS THAN ('2017-09-01')\n)\nDISTRIBUTED BY HASH(siteid) BUCKETS 10\nPROPERTIES(\"replication_num\" = \"1\");\n")),(0,t.yg)("p",null,"\u6570\u636e\u8868\u521b\u5efa\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u67e5\u770b example_db \u4e2d\u8868\u7684\u4fe1\u606f:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"mysql> SHOW TABLES;\n+----------------------+\n| Tables_in_example_db |\n+----------------------+\n| table1 |\n| table2 |\n+----------------------+\n2 rows in set (0.01 sec)\n\nmysql> DESC table1;\n+----------+-------------+------+-------+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+----------+-------------+------+-------+---------+-------+\n| siteid | int(11) | Yes | true | 10 | |\n| citycode | smallint(6) | Yes | true | N/A | |\n| username | varchar(32) | Yes | true | | |\n| pv | bigint(20) | Yes | false | 0 | SUM |\n+----------+-------------+------+-------+---------+-------+\n4 rows in set (0.00 sec)\n\nmysql> DESC table2;\n+-----------+-------------+------+-------+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+-----------+-------------+------+-------+---------+-------+\n| event_day | date | Yes | true | N/A | |\n| siteid | int(11) | Yes | true | 10 | |\n| citycode | smallint(6) | Yes | true | N/A | |\n| username | varchar(32) | Yes | true | | |\n| pv | bigint(20) | Yes | false | 0 | SUM |\n+-----------+-------------+------+-------+---------+-------+\n5 rows in set (0.00 sec)\n")),(0,t.yg)("blockquote",null,(0,t.yg)("p",{parentName:"blockquote"},"\u6ce8\u610f\u4e8b\u9879\uff1a")),(0,t.yg)("blockquote",null,(0,t.yg)("ol",{parentName:"blockquote"},(0,t.yg)("li",{parentName:"ol"},"\u4e0a\u8ff0\u8868\u901a\u8fc7\u8bbe\u7f6e replication_num \u5efa\u7684\u90fd\u662f\u5355\u526f\u672c\u7684\u8868\uff0cDoris\u5efa\u8bae\u7528\u6237\u91c7\u7528\u9ed8\u8ba4\u7684 3 \u526f\u672c\u8bbe\u7f6e\uff0c\u4ee5\u4fdd\u8bc1\u9ad8\u53ef\u7528\u3002"),(0,t.yg)("li",{parentName:"ol"},"\u53ef\u4ee5\u5bf9\u591a\u5206\u533a\u8868\u52a8\u6001\u7684\u589e\u5220\u5206\u533a\uff0c\u8be6\u89c1 ",(0,t.yg)("inlineCode",{parentName:"li"},"HELP ALTER TABLE;")," \u4e2d Partition \u76f8\u5173\u90e8\u5206\u3002"),(0,t.yg)("li",{parentName:"ol"},"\u6570\u636e\u5bfc\u5165\u53ef\u4ee5\u5bfc\u5165\u6307\u5b9a\u7684 Partition\uff0c\u8be6\u89c1 ",(0,t.yg)("inlineCode",{parentName:"li"},"HELP LOAD;"),"\u3002"),(0,t.yg)("li",{parentName:"ol"},"\u53ef\u4ee5\u52a8\u6001\u4fee\u6539\u8868\u7684 Schema\uff0c\u8be6\u89c1",(0,t.yg)("inlineCode",{parentName:"li"},"HELP ALTER TABLE;"),"\u3002"),(0,t.yg)("li",{parentName:"ol"},"\u53ef\u4ee5\u5bf9 Table \u589e\u52a0\u4e0a\u5377\u8868\uff08Rollup\uff09\u4ee5\u63d0\u9ad8\u67e5\u8be2\u6027\u80fd\uff0c\u8fd9\u90e8\u5206\u53ef\u4ee5\u53c2\u89c1\u9ad8\u7ea7\u4f7f\u7528\u6307\u5357\u5173\u4e8e Rollup \u7684\u63cf\u8ff0\u3002"),(0,t.yg)("li",{parentName:"ol"},"\u8868\u7684\u5217\u7684Null\u5c5e\u6027\u9ed8\u8ba4\u4e3atrue\uff0c\u4f1a\u5bf9\u67e5\u8be2\u6027\u80fd\u6709\u4e00\u5b9a\u7684\u5f71\u54cd\u3002"))),(0,t.yg)("h3",{id:"\u5bfc\u5165\u6570\u636e"},"\u5bfc\u5165\u6570\u636e"),(0,t.yg)("p",null,"Doris \u652f\u6301\u591a\u79cd\u6570\u636e\u5bfc\u5165\u65b9\u5f0f\u3002\u5177\u4f53\u53ef\u4ee5\u53c2\u9605 ",(0,t.yg)("a",{parentName:"p",href:"/zh-CN/docs/1.2/data-operate/import/load-manual"},"\u6570\u636e\u5bfc\u5165")," \u6587\u6863\u3002\u8fd9\u91cc\u6211\u4eec\u4f7f\u7528\u6d41\u5f0f\u5bfc\u5165\u548c Broker \u5bfc\u5165\u505a\u793a\u4f8b\u3002"),(0,t.yg)("h4",{id:"\u6d41\u5f0f\u5bfc\u5165"},"\u6d41\u5f0f\u5bfc\u5165"),(0,t.yg)("p",null,"\u6d41\u5f0f\u5bfc\u5165\u901a\u8fc7 HTTP \u534f\u8bae\u5411 Doris \u4f20\u8f93\u6570\u636e\uff0c\u53ef\u4ee5\u4e0d\u4f9d\u8d56\u5176\u4ed6\u7cfb\u7edf\u6216\u7ec4\u4ef6\u76f4\u63a5\u5bfc\u5165\u672c\u5730\u6570\u636e\u3002\u8be6\u7ec6\u8bed\u6cd5\u5e2e\u52a9\u53ef\u4ee5\u53c2\u9605 ",(0,t.yg)("inlineCode",{parentName:"p"},"HELP STREAM LOAD;"),"\u3002"),(0,t.yg)("p",null,'\u793a\u4f8b1\uff1a\u4ee5 "table1_20170707" \u4e3a Label\uff0c\u4f7f\u7528\u672c\u5730\u6587\u4ef6 table1_data \u5bfc\u5165 table1 \u8868\u3002'),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-bash"},'curl --location-trusted -u test:test_passwd -H "label:table1_20170707" -H "column_separator:," -T table1_data http://FE_HOST:8030/api/example_db/table1/_stream_load\n')),(0,t.yg)("blockquote",null,(0,t.yg)("ol",{parentName:"blockquote"},(0,t.yg)("li",{parentName:"ol"},"FE_HOST \u662f\u4efb\u4e00 FE \u6240\u5728\u8282\u70b9 IP\uff0c8030 \u4e3a fe.conf \u4e2d\u7684 http_port\u3002"),(0,t.yg)("li",{parentName:"ol"},"\u53ef\u4ee5\u4f7f\u7528\u4efb\u4e00 BE \u7684 IP\uff0c\u4ee5\u53ca be.conf \u4e2d\u7684 webserver_port \u8fdb\u884c\u5bfc\u5165\u3002\u5982\uff1a",(0,t.yg)("inlineCode",{parentName:"li"},"BE_HOST:8040")))),(0,t.yg)("p",null,"\u672c\u5730\u6587\u4ef6 ",(0,t.yg)("inlineCode",{parentName:"p"},"table1_data")," \u4ee5 ",(0,t.yg)("inlineCode",{parentName:"p"},",")," \u4f5c\u4e3a\u6570\u636e\u4e4b\u95f4\u7684\u5206\u9694\uff0c\u5177\u4f53\u5185\u5bb9\u5982\u4e0b\uff1a"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-text"},"1,1,jim,2\n2,1,grace,2\n3,2,tom,2\n4,3,bush,3\n5,3,helen,3\n")),(0,t.yg)("p",null,'\u793a\u4f8b2: \u4ee5 "table2_20170707" \u4e3a Label\uff0c\u4f7f\u7528\u672c\u5730\u6587\u4ef6 table2_data \u5bfc\u5165 table2 \u8868\u3002'),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-bash"},'curl --location-trusted -u test:test -H "label:table2_20170707" -H "column_separator:|" -T table2_data http://127.0.0.1:8030/api/example_db/table2/_stream_load\n')),(0,t.yg)("p",null,"\u672c\u5730\u6587\u4ef6 ",(0,t.yg)("inlineCode",{parentName:"p"},"table2_data")," \u4ee5 ",(0,t.yg)("inlineCode",{parentName:"p"},"|")," \u4f5c\u4e3a\u6570\u636e\u4e4b\u95f4\u7684\u5206\u9694\uff0c\u5177\u4f53\u5185\u5bb9\u5982\u4e0b\uff1a"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-text"},"2017-07-03|1|1|jim|2\n2017-07-05|2|1|grace|2\n2017-07-12|3|2|tom|2\n2017-07-15|4|3|bush|3\n2017-07-12|5|3|helen|3\n")),(0,t.yg)("blockquote",null,(0,t.yg)("p",{parentName:"blockquote"},"\u6ce8\u610f\u4e8b\u9879\uff1a"),(0,t.yg)("ol",{parentName:"blockquote"},(0,t.yg)("li",{parentName:"ol"},"\u91c7\u7528\u6d41\u5f0f\u5bfc\u5165\u5efa\u8bae\u6587\u4ef6\u5927\u5c0f\u9650\u5236\u5728 10GB \u4ee5\u5185\uff0c\u8fc7\u5927\u7684\u6587\u4ef6\u4f1a\u5bfc\u81f4\u5931\u8d25\u91cd\u8bd5\u4ee3\u4ef7\u53d8\u5927\u3002"),(0,t.yg)("li",{parentName:"ol"},"label\uff1aLabel \u7684\u4e3b\u8981\u4f5c\u7528\u662f\u552f\u4e00\u6807\u8bc6\u4e00\u4e2a\u5bfc\u5165\u4efb\u52a1\uff0c\u5e76\u4e14\u80fd\u591f\u4fdd\u8bc1\u76f8\u540c\u7684 Label \u4ec5\u4f1a\u88ab\u6210\u529f\u5bfc\u5165\u4e00\u6b21\uff0c\u5177\u4f53\u53ef\u4ee5\u67e5\u770b ",(0,t.yg)("a",{parentName:"li",href:"/zh-CN/docs/1.2/data-operate/import/import-scenes/load-atomicity"},"\u6570\u636e\u5bfc\u5165\u4e8b\u52a1\u53ca\u539f\u5b50\u6027 "),"\u3002"),(0,t.yg)("li",{parentName:"ol"},"\u6d41\u5f0f\u5bfc\u5165\u662f\u540c\u6b65\u547d\u4ee4\u3002\u547d\u4ee4\u8fd4\u56de\u6210\u529f\u5219\u8868\u793a\u6570\u636e\u5df2\u7ecf\u5bfc\u5165\uff0c\u8fd4\u56de\u5931\u8d25\u8868\u793a\u8fd9\u6279\u6570\u636e\u6ca1\u6709\u5bfc\u5165\u3002"))),(0,t.yg)("h4",{id:"broker-\u5bfc\u5165"},"Broker \u5bfc\u5165"),(0,t.yg)("p",null,"Broker \u5bfc\u5165\u901a\u8fc7\u90e8\u7f72\u7684 Broker \u8fdb\u7a0b\uff0c\u8bfb\u53d6\u5916\u90e8\u5b58\u50a8\u4e0a\u7684\u6570\u636e\u8fdb\u884c\u5bfc\u5165\u3002\u66f4\u591a\u5e2e\u52a9\u8bf7\u53c2\u9605 ",(0,t.yg)("inlineCode",{parentName:"p"},"HELP BROKER LOAD;")),(0,t.yg)("p",null,'\u793a\u4f8b\uff1a\u4ee5 "table1_20170708" \u4e3a Label\uff0c\u5c06 HDFS \u4e0a\u7684\u6587\u4ef6\u5bfc\u5165 table1 \u8868'),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},'LOAD LABEL table1_20170708\n(\n DATA INFILE("hdfs://your.namenode.host:port/dir/table1_data")\n INTO TABLE table1\n)\nWITH BROKER hdfs \n(\n "username"="hdfs_user",\n "password"="hdfs_password"\n)\nPROPERTIES\n(\n "timeout"="3600",\n "max_filter_ratio"="0.1"\n);\n')),(0,t.yg)("p",null,"Broker \u5bfc\u5165\u662f\u5f02\u6b65\u547d\u4ee4\u3002\u4ee5\u4e0a\u547d\u4ee4\u6267\u884c\u6210\u529f\u53ea\u8868\u793a\u63d0\u4ea4\u4efb\u52a1\u6210\u529f\u3002\u5bfc\u5165\u662f\u5426\u6210\u529f\u9700\u8981\u901a\u8fc7 ",(0,t.yg)("inlineCode",{parentName:"p"},"SHOW LOAD;")," \u67e5\u770b\u3002\u5982\uff1a"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},'SHOW LOAD WHERE LABEL = "table1_20170708";\n')),(0,t.yg)("p",null,"\u8fd4\u56de\u7ed3\u679c\u4e2d\uff0c",(0,t.yg)("inlineCode",{parentName:"p"},"State")," \u5b57\u6bb5\u4e3a ",(0,t.yg)("inlineCode",{parentName:"p"},"FINISHED")," \u5219\u8868\u793a\u5bfc\u5165\u6210\u529f\u3002"),(0,t.yg)("p",null,"\u5173\u4e8e ",(0,t.yg)("inlineCode",{parentName:"p"},"SHOW LOAD")," \u7684\u66f4\u591a\u8bf4\u660e\uff0c\u53ef\u4ee5\u53c2\u9605 ",(0,t.yg)("inlineCode",{parentName:"p"},"HELP SHOW LOAD;")),(0,t.yg)("p",null,"\u5f02\u6b65\u7684\u5bfc\u5165\u4efb\u52a1\u5728\u7ed3\u675f\u524d\u53ef\u4ee5\u53d6\u6d88\uff1a"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},'CANCEL LOAD WHERE LABEL = "table1_20170708";\n')),(0,t.yg)("h2",{id:"\u6570\u636e\u7684\u67e5\u8be2"},"\u6570\u636e\u7684\u67e5\u8be2"),(0,t.yg)("h3",{id:"\u7b80\u5355\u67e5\u8be2"},"\u7b80\u5355\u67e5\u8be2"),(0,t.yg)("p",null,"\u67e5\u8be2\u793a\u4f8b:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"mysql> SELECT * FROM table1 LIMIT 3;\n+--------+----------+----------+------+\n| siteid | citycode | username | pv |\n+--------+----------+----------+------+\n| 2 | 1 | 'grace' | 2 |\n| 5 | 3 | 'helen' | 3 |\n| 3 | 2 | 'tom' | 2 |\n+--------+----------+----------+------+\n3 rows in set (0.01 sec)\n\nmysql> SELECT * FROM table1 ORDER BY citycode;\n+--------+----------+----------+------+\n| siteid | citycode | username | pv |\n+--------+----------+----------+------+\n| 2 | 1 | 'grace' | 2 |\n| 1 | 1 | 'jim' | 2 |\n| 3 | 2 | 'tom' | 2 |\n| 4 | 3 | 'bush' | 3 |\n| 5 | 3 | 'helen' | 3 |\n+--------+----------+----------+------+\n5 rows in set (0.01 sec)\n")),(0,t.yg)("h3",{id:"select--except"},"SELECT * EXCEPT"),(0,t.yg)("version",{since:"1.2"},(0,t.yg)("p",null,(0,t.yg)("inlineCode",{parentName:"p"},"SELECT * EXCEPT")," \u8bed\u53e5\u6307\u5b9a\u8981\u4ece\u7ed3\u679c\u4e2d\u6392\u9664\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\u5217\u7684\u540d\u79f0\u3002\u8f93\u51fa\u4e2d\u5c06\u5ffd\u7565\u6240\u6709\u5339\u914d\u7684\u5217\u540d\u79f0\u3002"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"MySQL> SELECT * except (username, citycode) FROM table1;\n+--------+------+\n| siteid | pv |\n+--------+------+\n| 2 | 2 |\n| 5 | 3 |\n| 3 | 2 |\n+--------+------+\n3 rows in set (0.01 sec)\n")),(0,t.yg)("p",null,(0,t.yg)("strong",{parentName:"p"},"\u6ce8\u610f"),"\uff1a",(0,t.yg)("inlineCode",{parentName:"p"},"SELECT * EXCEPT")," \u4e0d\u4f1a\u6392\u9664\u6ca1\u6709\u540d\u79f0\u7684\u5217\u3002")),(0,t.yg)("h3",{id:"join-\u67e5\u8be2"},"Join \u67e5\u8be2"),(0,t.yg)("p",null,"\u67e5\u8be2\u793a\u4f8b:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"mysql> SELECT SUM(table1.pv) FROM table1 JOIN table2 WHERE table1.siteid = table2.siteid;\n+--------------------+\n| sum(`table1`.`pv`) |\n+--------------------+\n| 12 |\n+--------------------+\n1 row in set (0.20 sec)\n")),(0,t.yg)("h3",{id:"\u5b50\u67e5\u8be2"},"\u5b50\u67e5\u8be2"),(0,t.yg)("p",null,"\u67e5\u8be2\u793a\u4f8b:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"mysql> SELECT SUM(pv) FROM table2 WHERE siteid IN (SELECT siteid FROM table1 WHERE siteid > 2);\n+-----------+\n| sum(`pv`) |\n+-----------+\n| 8 |\n+-----------+\n1 row in set (0.13 sec)\n")),(0,t.yg)("h2",{id:"\u8868\u7ed3\u6784\u53d8\u66f4"},"\u8868\u7ed3\u6784\u53d8\u66f4"),(0,t.yg)("p",null,"\u4f7f\u7528 ",(0,t.yg)("a",{parentName:"p",href:"/zh-CN/docs/1.2/sql-manual/sql-reference/Data-Definition-Statements/Alter/ALTER-TABLE-COLUMN"},"ALTER TABLE COLUMN")," \u547d\u4ee4\u53ef\u4ee5\u4fee\u6539\u8868\u7684 Schema\uff0c\u5305\u62ec\u5982\u4e0b\u4fee\u6539\uff1a"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},"\u589e\u52a0\u5217"),(0,t.yg)("li",{parentName:"ul"},"\u5220\u9664\u5217"),(0,t.yg)("li",{parentName:"ul"},"\u4fee\u6539\u5217\u7c7b\u578b"),(0,t.yg)("li",{parentName:"ul"},"\u6539\u53d8\u5217\u987a\u5e8f")),(0,t.yg)("p",null,"\u4ee5\u4e0b\u901a\u8fc7\u4f7f\u7528\u793a\u4f8b\u8bf4\u660e\u8868\u7ed3\u6784\u53d8\u66f4\uff1a"),(0,t.yg)("p",null,"\u539f\u8868 table1 \u7684 Schema \u5982\u4e0b:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-text"},"+----------+-------------+------+-------+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+----------+-------------+------+-------+---------+-------+\n| siteid | int(11) | No | true | 10 | |\n| citycode | smallint(6) | No | true | N/A | |\n| username | varchar(32) | No | true | | |\n| pv | bigint(20) | No | false | 0 | SUM |\n+----------+-------------+------+-------+---------+-------+\n")),(0,t.yg)("p",null,"\u6211\u4eec\u65b0\u589e\u4e00\u5217 uv\uff0c\u7c7b\u578b\u4e3a BIGINT\uff0c\u805a\u5408\u7c7b\u578b\u4e3a SUM\uff0c\u9ed8\u8ba4\u503c\u4e3a 0:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"ALTER TABLE table1 ADD COLUMN uv BIGINT SUM DEFAULT '0' after pv;\n")),(0,t.yg)("p",null,"\u63d0\u4ea4\u6210\u529f\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u4f5c\u4e1a\u8fdb\u5ea6:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"SHOW ALTER TABLE COLUMN;\n")),(0,t.yg)("p",null,"\u5f53\u4f5c\u4e1a\u72b6\u6001\u4e3a ",(0,t.yg)("inlineCode",{parentName:"p"},"FINISHED"),"\uff0c\u5219\u8868\u793a\u4f5c\u4e1a\u5b8c\u6210\u3002\u65b0\u7684 Schema \u5df2\u751f\u6548\u3002"),(0,t.yg)("p",null,"ALTER TABLE \u5b8c\u6210\u4e4b\u540e, \u53ef\u4ee5\u901a\u8fc7 ",(0,t.yg)("inlineCode",{parentName:"p"},"DESC TABLE")," \u67e5\u770b\u6700\u65b0\u7684 Schema\u3002"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"mysql> DESC table1;\n+----------+-------------+------+-------+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+----------+-------------+------+-------+---------+-------+\n| siteid | int(11) | No | true | 10 | |\n| citycode | smallint(6) | No | true | N/A | |\n| username | varchar(32) | No | true | | |\n| pv | bigint(20) | No | false | 0 | SUM |\n| uv | bigint(20) | No | false | 0 | SUM |\n+----------+-------------+------+-------+---------+-------+\n5 rows in set (0.00 sec)\n")),(0,t.yg)("p",null,"\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u53d6\u6d88\u5f53\u524d\u6b63\u5728\u6267\u884c\u7684\u4f5c\u4e1a:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"CANCEL ALTER TABLE COLUMN FROM table1;\n")),(0,t.yg)("p",null,"\u66f4\u591a\u5e2e\u52a9\uff0c\u53ef\u4ee5\u53c2\u9605 ",(0,t.yg)("inlineCode",{parentName:"p"},"HELP ALTER TABLE"),"\u3002"),(0,t.yg)("h2",{id:"rollup"},"Rollup"),(0,t.yg)("p",null,"Rollup \u53ef\u4ee5\u7406\u89e3\u4e3a Table \u7684\u4e00\u4e2a\u7269\u5316\u7d22\u5f15\u7ed3\u6784\u3002",(0,t.yg)("strong",{parentName:"p"},"\u7269\u5316")," \u662f\u56e0\u4e3a\u5176\u6570\u636e\u5728\u7269\u7406\u4e0a\u72ec\u7acb\u5b58\u50a8\uff0c\u800c ",(0,t.yg)("strong",{parentName:"p"},"\u7d22\u5f15")," \u7684\u610f\u601d\u662f\uff0cRollup\u53ef\u4ee5\u8c03\u6574\u5217\u987a\u5e8f\u4ee5\u589e\u52a0\u524d\u7f00\u7d22\u5f15\u7684\u547d\u4e2d\u7387\uff0c\u4e5f\u53ef\u4ee5\u51cf\u5c11key\u5217\u4ee5\u589e\u52a0\u6570\u636e\u7684\u805a\u5408\u5ea6\u3002"),(0,t.yg)("p",null,"\u4f7f\u7528",(0,t.yg)("a",{parentName:"p",href:"/zh-CN/docs/1.2/sql-manual/sql-reference/Data-Definition-Statements/Alter/ALTER-TABLE-ROLLUP"},"ALTER TABLE ROLLUP"),"\u53ef\u4ee5\u8fdb\u884cRollup\u7684\u5404\u79cd\u53d8\u66f4\u64cd\u4f5c\u3002"),(0,t.yg)("p",null,"\u4ee5\u4e0b\u4e3e\u4f8b\u8bf4\u660e"),(0,t.yg)("p",null,"\u539f\u8868table1\u7684Schema\u5982\u4e0b:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-text"},"+----------+-------------+------+-------+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+----------+-------------+------+-------+---------+-------+\n| siteid | int(11) | No | true | 10 | |\n| citycode | smallint(6) | No | true | N/A | |\n| username | varchar(32) | No | true | | |\n| pv | bigint(20) | No | false | 0 | SUM |\n| uv | bigint(20) | No | false | 0 | SUM |`\n+----------+-------------+------+-------+---------+-------+\n")),(0,t.yg)("p",null,"\u5bf9\u4e8e table1 \u660e\u7ec6\u6570\u636e\u662f siteid, citycode, username \u4e09\u8005\u6784\u6210\u4e00\u7ec4 key\uff0c\u4ece\u800c\u5bf9 pv \u5b57\u6bb5\u8fdb\u884c\u805a\u5408\uff1b\u5982\u679c\u4e1a\u52a1\u65b9\u7ecf\u5e38\u6709\u770b\u57ce\u5e02 pv \u603b\u91cf\u7684\u9700\u6c42\uff0c\u53ef\u4ee5\u5efa\u7acb\u4e00\u4e2a\u53ea\u6709 citycode, pv \u7684rollup\u3002"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"ALTER TABLE table1 ADD ROLLUP rollup_city(citycode, pv);\n")),(0,t.yg)("p",null,"\u63d0\u4ea4\u6210\u529f\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u4f5c\u4e1a\u8fdb\u5ea6\uff1a"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"SHOW ALTER TABLE ROLLUP;\n")),(0,t.yg)("p",null,"\u5f53\u4f5c\u4e1a\u72b6\u6001\u4e3a ",(0,t.yg)("inlineCode",{parentName:"p"},"FINISHED"),"\uff0c\u5219\u8868\u793a\u4f5c\u4e1a\u5b8c\u6210\u3002"),(0,t.yg)("p",null,"Rollup \u5efa\u7acb\u5b8c\u6210\u4e4b\u540e\u53ef\u4ee5\u4f7f\u7528 ",(0,t.yg)("inlineCode",{parentName:"p"},"DESC table1 ALL")," \u67e5\u770b\u8868\u7684 Rollup \u4fe1\u606f\u3002"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"mysql> desc table1 all;\n+-------------+----------+-------------+------+-------+--------+-------+\n| IndexName | Field | Type | Null | Key | Default | Extra |\n+-------------+----------+-------------+------+-------+---------+-------+\n| table1 | siteid | int(11) | No | true | 10 | |\n| | citycode | smallint(6) | No | true | N/A | |\n| | username | varchar(32) | No | true | | |\n| | pv | bigint(20) | No | false | 0 | SUM |\n| | uv | bigint(20) | No | false | 0 | SUM |\n| | | | | | | |\n| rollup_city | citycode | smallint(6) | No | true | N/A | |\n| | pv | bigint(20) | No | false | 0 | SUM |\n+-------------+----------+-------------+------+-------+---------+-------+\n8 rows in set (0.01 sec)\n")),(0,t.yg)("p",null,"\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u53d6\u6d88\u5f53\u524d\u6b63\u5728\u6267\u884c\u7684\u4f5c\u4e1a:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"CANCEL ALTER TABLE ROLLUP FROM table1;\n")),(0,t.yg)("p",null,"Rollup \u5efa\u7acb\u4e4b\u540e\uff0c\u67e5\u8be2\u4e0d\u9700\u8981\u6307\u5b9a Rollup \u8fdb\u884c\u67e5\u8be2\u3002\u8fd8\u662f\u6307\u5b9a\u539f\u6709\u8868\u8fdb\u884c\u67e5\u8be2\u5373\u53ef\u3002\u7a0b\u5e8f\u4f1a\u81ea\u52a8\u5224\u65ad\u662f\u5426\u5e94\u8be5\u4f7f\u7528 Rollup\u3002\u662f\u5426\u547d\u4e2d Rollup\u53ef\u4ee5\u901a\u8fc7 ",(0,t.yg)("inlineCode",{parentName:"p"},"EXPLAIN your_sql;")," \u547d\u4ee4\u8fdb\u884c\u67e5\u770b\u3002"),(0,t.yg)("p",null,"\u66f4\u591a\u5e2e\u52a9\uff0c\u53ef\u4ee5\u53c2\u9605 ",(0,t.yg)("inlineCode",{parentName:"p"},"HELP ALTER TABLE"),"\u3002"),(0,t.yg)("h2",{id:"\u7269\u5316\u89c6\u56fe"},"\u7269\u5316\u89c6\u56fe"),(0,t.yg)("p",null,"\u7269\u5316\u89c6\u56fe\u662f\u4e00\u79cd\u4ee5\u7a7a\u95f4\u6362\u65f6\u95f4\u7684\u6570\u636e\u5206\u6790\u52a0\u901f\u6280\u672f\u3002Doris \u652f\u6301\u5728\u57fa\u7840\u8868\u4e4b\u4e0a\u5efa\u7acb\u7269\u5316\u89c6\u56fe\u3002\u6bd4\u5982\u53ef\u4ee5\u5728\u660e\u7ec6\u6570\u636e\u6a21\u578b\u7684\u8868\u4e0a\u5efa\u7acb\u57fa\u4e8e\u90e8\u5206\u5217\u7684\u805a\u5408\u89c6\u56fe\uff0c\u8fd9\u6837\u53ef\u4ee5\u540c\u65f6\u6ee1\u8db3\u5bf9\u660e\u7ec6\u6570\u636e\u548c\u805a\u5408\u6570\u636e\u7684\u5feb\u901f\u67e5\u8be2\u3002"),(0,t.yg)("p",null,"\u540c\u65f6\uff0cDoris \u80fd\u591f\u81ea\u52a8\u4fdd\u8bc1\u7269\u5316\u89c6\u56fe\u548c\u57fa\u7840\u8868\u7684\u6570\u636e\u4e00\u81f4\u6027\uff0c\u5e76\u4e14\u5728\u67e5\u8be2\u65f6\u81ea\u52a8\u5339\u914d\u5408\u9002\u7684\u7269\u5316\u89c6\u56fe\uff0c\u6781\u5927\u964d\u4f4e\u7528\u6237\u7684\u6570\u636e\u7ef4\u62a4\u6210\u672c\uff0c\u4e3a\u7528\u6237\u63d0\u4f9b\u4e00\u4e2a\u4e00\u81f4\u4e14\u900f\u660e\u7684\u67e5\u8be2\u52a0\u901f\u4f53\u9a8c\u3002"),(0,t.yg)("p",null,"\u5173\u4e8e\u7269\u5316\u89c6\u56fe\u7684\u5177\u4f53\u4ecb\u7ecd\uff0c\u53ef\u53c2\u9605 ",(0,t.yg)("a",{parentName:"p",href:"/zh-CN/docs/1.2/query-acceleration/materialized-view"},"\u7269\u5316\u89c6\u56fe")),(0,t.yg)("h2",{id:"\u6570\u636e\u8868\u7684\u67e5\u8be2"},"\u6570\u636e\u8868\u7684\u67e5\u8be2"),(0,t.yg)("h3",{id:"\u5185\u5b58\u9650\u5236"},"\u5185\u5b58\u9650\u5236"),(0,t.yg)("p",null,"\u4e3a\u4e86\u9632\u6b62\u7528\u6237\u7684\u4e00\u4e2a\u67e5\u8be2\u53ef\u80fd\u56e0\u4e3a\u6d88\u8017\u5185\u5b58\u8fc7\u5927\u3002\u67e5\u8be2\u8fdb\u884c\u4e86\u5185\u5b58\u63a7\u5236\uff0c\u4e00\u4e2a\u67e5\u8be2\u4efb\u52a1\uff0c\u5728\u5355\u4e2a BE \u8282\u70b9\u4e0a\u9ed8\u8ba4\u4f7f\u7528\u4e0d\u8d85\u8fc7 2GB \u5185\u5b58\u3002"),(0,t.yg)("p",null,"\u7528\u6237\u5728\u4f7f\u7528\u65f6\uff0c\u5982\u679c\u53d1\u73b0\u62a5 ",(0,t.yg)("inlineCode",{parentName:"p"},"Memory limit exceeded")," \u9519\u8bef\uff0c\u4e00\u822c\u662f\u8d85\u8fc7\u5185\u5b58\u9650\u5236\u4e86\u3002"),(0,t.yg)("p",null,"\u9047\u5230\u5185\u5b58\u8d85\u9650\u65f6\uff0c\u7528\u6237\u5e94\u8be5\u5c3d\u91cf\u901a\u8fc7\u4f18\u5316\u81ea\u5df1\u7684 sql \u8bed\u53e5\u6765\u89e3\u51b3\u3002"),(0,t.yg)("p",null,"\u5982\u679c\u786e\u5207\u53d1\u73b02GB\u5185\u5b58\u4e0d\u80fd\u6ee1\u8db3\uff0c\u53ef\u4ee5\u624b\u52a8\u8bbe\u7f6e\u5185\u5b58\u53c2\u6570\u3002"),(0,t.yg)("p",null,"\u663e\u793a\u67e5\u8be2\u5185\u5b58\u9650\u5236:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},'mysql> SHOW VARIABLES LIKE "%mem_limit%";\n+---------------+------------+\n| Variable_name | Value |\n+---------------+------------+\n| exec_mem_limit| 2147483648 |\n+---------------+------------+\n1 row in set (0.00 sec)\n')),(0,t.yg)("p",null,(0,t.yg)("inlineCode",{parentName:"p"},"exec_mem_limit")," \u7684\u5355\u4f4d\u662f byte\uff0c\u53ef\u4ee5\u901a\u8fc7 ",(0,t.yg)("inlineCode",{parentName:"p"},"SET")," \u547d\u4ee4\u6539\u53d8 ",(0,t.yg)("inlineCode",{parentName:"p"},"exec_mem_limit")," \u7684\u503c\u3002\u5982\u6539\u4e3a 8GB\u3002"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},'mysql> SET exec_mem_limit = 8589934592;\nQuery OK, 0 rows affected (0.00 sec)\nmysql> SHOW VARIABLES LIKE "%mem_limit%";\n+---------------+------------+\n| Variable_name | Value |\n+---------------+------------+\n| exec_mem_limit| 8589934592 |\n+---------------+------------+\n1 row in set (0.00 sec)\n')),(0,t.yg)("blockquote",null,(0,t.yg)("ul",{parentName:"blockquote"},(0,t.yg)("li",{parentName:"ul"},"\u4ee5\u4e0a\u8be5\u4fee\u6539\u4e3a session \u7ea7\u522b\uff0c\u4ec5\u5728\u5f53\u524d\u8fde\u63a5 session \u5185\u6709\u6548\u3002\u65ad\u5f00\u91cd\u8fde\u5219\u4f1a\u53d8\u56de\u9ed8\u8ba4\u503c\u3002"),(0,t.yg)("li",{parentName:"ul"},"\u5982\u679c\u9700\u8981\u4fee\u6539\u5168\u5c40\u53d8\u91cf\uff0c\u53ef\u4ee5\u8fd9\u6837\u8bbe\u7f6e\uff1a",(0,t.yg)("inlineCode",{parentName:"li"},"SET GLOBAL exec_mem_limit = 8589934592;"),"\u3002\u8bbe\u7f6e\u5b8c\u6210\u540e\uff0c\u65ad\u5f00 session \u91cd\u65b0\u767b\u5f55\uff0c\u53c2\u6570\u5c06\u6c38\u4e45\u751f\u6548\u3002"))),(0,t.yg)("h3",{id:"\u67e5\u8be2\u8d85\u65f6"},"\u67e5\u8be2\u8d85\u65f6"),(0,t.yg)("p",null,"\u5f53\u524d\u9ed8\u8ba4\u67e5\u8be2\u65f6\u95f4\u8bbe\u7f6e\u4e3a\u6700\u957f\u4e3a 300 \u79d2\uff0c\u5982\u679c\u4e00\u4e2a\u67e5\u8be2\u5728 300 \u79d2\u5185\u6ca1\u6709\u5b8c\u6210\uff0c\u5219\u67e5\u8be2\u4f1a\u88ab Doris \u7cfb\u7edf cancel \u6389\u3002\u7528\u6237\u53ef\u4ee5\u901a\u8fc7\u8fd9\u4e2a\u53c2\u6570\u6765\u5b9a\u5236\u81ea\u5df1\u5e94\u7528\u7684\u8d85\u65f6\u65f6\u95f4\uff0c\u5b9e\u73b0\u7c7b\u4f3c wait(timeout) \u7684\u963b\u585e\u65b9\u5f0f\u3002"),(0,t.yg)("p",null,"\u67e5\u770b\u5f53\u524d\u8d85\u65f6\u8bbe\u7f6e:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},'mysql> SHOW VARIABLES LIKE "%query_timeout%";\n+---------------+-------+\n| Variable_name | Value |\n+---------------+-------+\n| QUERY_TIMEOUT | 300 |\n+---------------+-------+\n1 row in set (0.00 sec)\n')),(0,t.yg)("p",null,"\u4fee\u6539\u8d85\u65f6\u65f6\u95f4\u52301\u5206\u949f:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"mysql> SET query_timeout = 60;\nQuery OK, 0 rows affected (0.00 sec)\n")),(0,t.yg)("blockquote",null,(0,t.yg)("ul",{parentName:"blockquote"},(0,t.yg)("li",{parentName:"ul"},"\u5f53\u524d\u8d85\u65f6\u7684\u68c0\u67e5\u95f4\u9694\u4e3a 5 \u79d2\uff0c\u6240\u4ee5\u5c0f\u4e8e 5 \u79d2\u7684\u8d85\u65f6\u4e0d\u4f1a\u592a\u51c6\u786e\u3002"),(0,t.yg)("li",{parentName:"ul"},"\u4ee5\u4e0a\u4fee\u6539\u540c\u6837\u4e3a session \u7ea7\u522b\u3002\u53ef\u4ee5\u901a\u8fc7 ",(0,t.yg)("inlineCode",{parentName:"li"},"SET GLOBAL")," \u4fee\u6539\u5168\u5c40\u6709\u6548\u3002"))),(0,t.yg)("h3",{id:"broadcastshuffle-join"},"Broadcast/Shuffle Join"),(0,t.yg)("p",null,"\u7cfb\u7edf\u9ed8\u8ba4\u5b9e\u73b0 Join \u7684\u65b9\u5f0f\uff0c\u662f\u5c06\u5c0f\u8868\u8fdb\u884c\u6761\u4ef6\u8fc7\u6ee4\u540e\uff0c\u5c06\u5176\u5e7f\u64ad\u5230\u5927\u8868\u6240\u5728\u7684\u5404\u4e2a\u8282\u70b9\u4e0a\uff0c\u5f62\u6210\u4e00\u4e2a\u5185\u5b58 Hash \u8868\uff0c\u7136\u540e\u6d41\u5f0f\u8bfb\u51fa\u5927\u8868\u7684\u6570\u636e\u8fdb\u884cHash Join\u3002\u4f46\u662f\u5982\u679c\u5f53\u5c0f\u8868\u8fc7\u6ee4\u540e\u7684\u6570\u636e\u91cf\u65e0\u6cd5\u653e\u5165\u5185\u5b58\u7684\u8bdd\uff0c\u6b64\u65f6 Join \u5c06\u65e0\u6cd5\u5b8c\u6210\uff0c\u901a\u5e38\u7684\u62a5\u9519\u5e94\u8be5\u662f\u9996\u5148\u9020\u6210\u5185\u5b58\u8d85\u9650\u3002"),(0,t.yg)("p",null,"\u5982\u679c\u9047\u5230\u4e0a\u8ff0\u60c5\u51b5\uff0c\u5efa\u8bae\u663e\u5f0f\u6307\u5b9a Shuffle Join\uff0c\u4e5f\u88ab\u79f0\u4f5c Partitioned Join\u3002\u5373\u5c06\u5c0f\u8868\u548c\u5927\u8868\u90fd\u6309\u7167 Join \u7684 key \u8fdb\u884c Hash\uff0c\u7136\u540e\u8fdb\u884c\u5206\u5e03\u5f0f\u7684 Join\u3002\u8fd9\u4e2a\u5bf9\u5185\u5b58\u7684\u6d88\u8017\u5c31\u4f1a\u5206\u644a\u5230\u96c6\u7fa4\u7684\u6240\u6709\u8ba1\u7b97\u8282\u70b9\u4e0a\u3002"),(0,t.yg)("p",null,"Doris\u4f1a\u81ea\u52a8\u5c1d\u8bd5\u8fdb\u884c Broadcast Join\uff0c\u5982\u679c\u9884\u4f30\u5c0f\u8868\u8fc7\u5927\u5219\u4f1a\u81ea\u52a8\u5207\u6362\u81f3 Shuffle Join\u3002\u6ce8\u610f\uff0c\u5982\u679c\u6b64\u65f6\u663e\u5f0f\u6307\u5b9a\u4e86 Broadcast Join\uff0c\u5219\u4f1a\u5f3a\u5236\u6267\u884c Broadcast Join\u3002"),(0,t.yg)("p",null,"\u4f7f\u7528 Broadcast Join\uff08\u9ed8\u8ba4\uff09:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"mysql> select sum(table1.pv) from table1 join table2 where table1.siteid = 2;\n+--------------------+\n| sum(`table1`.`pv`) |\n+--------------------+\n| 10 |\n+--------------------+\n1 row in set (0.20 sec)\n")),(0,t.yg)("p",null,"\u4f7f\u7528 Broadcast Join\uff08\u663e\u5f0f\u6307\u5b9a\uff09:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"mysql> select sum(table1.pv) from table1 join [broadcast] table2 where table1.siteid = 2;\n+--------------------+\n| sum(`table1`.`pv`) |\n+--------------------+\n| 10 |\n+--------------------+\n1 row in set (0.20 sec)\n")),(0,t.yg)("p",null,"\u4f7f\u7528 Shuffle Join:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-sql"},"mysql> select sum(table1.pv) from table1 join [shuffle] table2 where table1.siteid = 2;\n+--------------------+\n| sum(`table1`.`pv`) |\n+--------------------+\n| 10 |\n+--------------------+\n1 row in set (0.15 sec)\n")),(0,t.yg)("h3",{id:"\u67e5\u8be2\u91cd\u8bd5\u548c\u9ad8\u53ef\u7528"},"\u67e5\u8be2\u91cd\u8bd5\u548c\u9ad8\u53ef\u7528"),(0,t.yg)("p",null,"\u5f53\u90e8\u7f72\u591a\u4e2a FE \u8282\u70b9\u65f6\uff0c\u7528\u6237\u53ef\u4ee5\u5728\u591a\u4e2a FE \u4e4b\u4e0a\u90e8\u7f72\u8d1f\u8f7d\u5747\u8861\u5c42\u6765\u5b9e\u73b0 Doris \u7684\u9ad8\u53ef\u7528\u3002"),(0,t.yg)("p",null,"\u5177\u4f53\u5b89\u88c5\u90e8\u7f72\u53ca\u4f7f\u7528\u65b9\u5f0f\u8bf7\u53c2\u7167 ",(0,t.yg)("a",{parentName:"p",href:"/zh-CN/docs/1.2/admin-manual/cluster-management/load-balancing"},"\u8d1f\u8f7d\u5747\u8861")),(0,t.yg)("h2",{id:"\u6570\u636e\u66f4\u65b0\u548c\u5220\u9664"},"\u6570\u636e\u66f4\u65b0\u548c\u5220\u9664"),(0,t.yg)("p",null,"Doris \u652f\u6301\u901a\u8fc7\u4e24\u79cd\u65b9\u5f0f\u5bf9\u5df2\u5bfc\u5165\u7684\u6570\u636e\u8fdb\u884c\u5220\u9664\u3002\u4e00\u79cd\u662f\u901a\u8fc7 DELETE FROM \u8bed\u53e5\uff0c\u6307\u5b9a WHERE \u6761\u4ef6\u5bf9\u6570\u636e\u8fdb\u884c\u5220\u9664\u3002\u8fd9\u79cd\u65b9\u5f0f\u6bd4\u8f83\u901a\u7528\uff0c\u9002\u5408\u9891\u7387\u8f83\u4f4e\u7684\u5b9a\u65f6\u5220\u9664\u4efb\u52a1\u3002"),(0,t.yg)("p",null,"\u53e6\u4e00\u79cd\u5220\u9664\u65b9\u5f0f\u4ec5\u9488\u5bf9 Unique \u4e3b\u952e\u552f\u4e00\u6a21\u578b\uff0c\u901a\u8fc7\u5bfc\u5165\u6570\u636e\u7684\u65b9\u5f0f\u5c06\u9700\u8981\u5220\u9664\u7684\u4e3b\u952e\u884c\u6570\u636e\u8fdb\u884c\u5bfc\u5165\u3002Doris \u5185\u90e8\u4f1a\u901a\u8fc7\u5220\u9664\u6807\u8bb0\u4f4d\u5bf9\u6570\u636e\u8fdb\u884c\u6700\u7ec8\u7684\u7269\u7406\u5220\u9664\u3002\u8fd9\u79cd\u5220\u9664\u65b9\u5f0f\u9002\u5408\u4ee5\u5b9e\u65f6\u7684\u65b9\u5f0f\u5bf9\u6570\u636e\u8fdb\u884c\u5220\u9664\u3002"),(0,t.yg)("p",null,"\u5173\u4e8e\u5220\u9664\u548c\u66f4\u65b0\u64cd\u4f5c\u7684\u5177\u4f53\u8bf4\u660e\uff0c\u53ef\u53c2\u9605 ",(0,t.yg)("a",{parentName:"p",href:"/zh-CN/docs/1.2/data-operate/update-delete/update"},"\u6570\u636e\u66f4\u65b0")," \u76f8\u5173\u6587\u6863\u3002"))}g.isMDXComponent=!0}}]);