3B
,它的内存开销也是3B
。A + B
,内存开销为 B
。B < min(3B, A + B)
B <= min(3B, B)
enable_bucket_shuffle_join
设置为true
,则FE在进行查询规划时就会默认将能够转换为 Bucket Shuffle Join 的查询自动规划为 Bucket Shuffle Join。set enable_bucket_shuffle_join = true;
select * from test join [shuffle] baseall on test.k1 = baseall.k1;
true
, 而0.13版本需要手动设置为true
。explain
命令来查看Join是否为Bucket Shuffle Join:| 2:HASH JOIN || | join op: INNER JOIN (BUCKET_SHUFFLE) || | hash predicates: || | colocate: false, reason: table not in the same group || | equal join conjunct: `test`.`k1` = `baseall`.`k1`
BUCKET_SHUFFLE
。where
条件使分区裁剪的策略能够生效。select l_orderkey,sum(l_extendedprice * (1 - l_discount)) as revenue,o_orderdate, o_shippriorityfrom (select l_orderkey, l_extendedprice, l_discount, o_orderdate, o_shippriority, o_custkeyfrom lineitemjoin orderswhere l_orderkey = o_orderkeyand o_orderdate < date '1995-03-15'and l_shipdate > date '1995-03-15' ) t1join customer c on c.c_custkey = t1.o_custkeywhere c_mktsegment = 'BUILDING'group by l_orderkey, o_orderdate, o_shippriorityorder by revenue desc, o_orderdatelimit 10;
select l_orderkey, l_extendedprice, l_discount, o_orderdate, o_shippriority, o_custkeyfrom lineitemjoin orderswhere l_orderkey = o_orderkeyand o_orderdate < date '1995-03-15'and l_shipdate > date '1995-03-15'
MySQL [tpch_100_d]> show variables like "%enable_bucket_shuffle_join%";+----------------------------+-------+| Variable_name | Value |+----------------------------+-------+| enable_bucket_shuffle_join | true |+----------------------------+-------+1 row in set (0.00 sec)
CREATE TABLE `lineitem` (`l_shipdate` date NOT NULL,`l_orderkey` bigint(20) NOT NULL,`l_linenumber` int(11) NOT NULL,`l_partkey` int(11) NOT NULL,`l_suppkey` int(11) NOT NULL,`l_quantity` decimalv3(15, 2) NOT NULL,`l_extendedprice` decimalv3(15, 2) NOT NULL,`l_discount` decimalv3(15, 2) NOT NULL,`l_tax` decimalv3(15, 2) NOT NULL,`l_returnflag` varchar(1) NOT NULL,`l_linestatus` varchar(1) NOT NULL,`l_commitdate` date NOT NULL,`l_receiptdate` date NOT NULL,`l_shipinstruct` varchar(25) NOT NULL,`l_shipmode` varchar(10) NOT NULL,`l_comment` varchar(44) NOT NULL) ENGINE=OLAPDUPLICATE KEY(`l_shipdate`, `l_orderkey`)COMMENT 'OLAP'DISTRIBUTED BY HASH(`l_orderkey`) BUCKETS 96PROPERTIES ("replication_allocation" = "tag.location.default: 3","in_memory" = "false","storage_format" = "V2","disable_auto_compaction" = "false");CREATE TABLE `orders` (`o_orderkey` bigint(20) NOT NULL,`o_orderdate` date NOT NULL,`o_custkey` int(11) NOT NULL,`o_orderstatus` varchar(1) NOT NULL,`o_totalprice` decimalv3(15, 2) NOT NULL,`o_orderpriority` varchar(15) NOT NULL,`o_clerk` varchar(15) NOT NULL,`o_shippriority` int(11) NOT NULL,`o_comment` varchar(79) NOT NULL) ENGINE=OLAPDUPLICATE KEY(`o_orderkey`, `o_orderdate`) COMMENT 'OLAP'DISTRIBUTED BY HASH(`o_orderkey`) BUCKETS 96PROPERTIES ("replication_allocation" = "tag.location.default: 3","in_memory" = "false","storage_format" = "V2","disable_auto_compaction" = "false");
本页内容是否解决了您的问题?