MAPREDUCE服务 MRS-Flink SQL逻辑开发规则:多流Join场景事实流表个数不超过三个

时间:2024-10-22 10:50:54

多流Join场景事实流表个数不超过三个

当Join表过多时,状态后端压力太大会导致端到端时延增加。

【示例】实时Join维表数3个:

CREATE TABLE table1(id  int, param1 string) with(...);
CREATE TABLE table2(id  int, param2 string) with(...);
CREATE TABLE table3(id  int, param3 string) with(...);
CREATE TABLE orders (
     order_id    STRING,
     price       DECIMAL(32,2),
     currency    STRING,
     order_time  TIMESTAMP(3),
     WATERMARK FOR order_time AS order_time
) WITH (/* ... */);

select 
    o.*, t1.param1, t2.param2, t3.param3
from 
    orders AS o
    JOIN table1 AS t1 ON o.order_id = t1.id
    JOIN table2 AS t2 ON o.order_id = t2.id
    JOIN table3 AS t3 ON o.order_id = t3.id;
support.huaweicloud.com/devg-rule-mrs/mrs_07_450169.html