pingcap / pingcap/tiflash

TiDB cannot push down broadcast join which has aggregations in one of data side

Open
#1,174 0 comments 0 reactions 1 assignee View on GitHub

@hanfei1991 is already working on this.

Since Oct 22, 2020.

component/mpp type/enhancement
Dominant language
C++
Stars
1k
Forks
423
Avg merge
1d 15h
Merged PRs (30d)
24

Description

set @@session.tidb_allow_batch_cop=1; # 合并对 TiFlash 的数据请求
set @@session.tidb_opt_broadcast_join=1; # 开启 broadcast join 优化,
explain analyze
select
       max(`name`) as name,
       value,
       max(hopIpValue) as hopIpValue,
       max(hop_type) as hopType,
       case when max(`group1`)='' then '未知' else max(`group1`) end as `group`,
#        arrayStringConcat(groupUniqArray(active_state_unit),',') as protocol,
       case when (max(t3.`group1`)='' and value not like '%_*' and value !='*') then 0 else 1 end as status,
       max(`deviceType`) as deviceType,
       min(hop) as minHop,
       max(endTime) as endTime
from (
         SELECT /*+ broadcast_join(t1, t2),  broadcast_join_local(t1) */
                t1.hop_ip as `name`,
                t1.hop as `hop`,
                hop_ip_int as `hopIpValue`,
                t1.hop_ip as value,
                case when t1.hop_ip=t1.ip then 1 else 0 end as hop_type,
                t1.active_state_unit as active_state_unit,
                t1.hop_ip_bizgroup as `group1`,
                t1.device_type as `deviceType`,
                t1.end_time as endTime
         from vnap_data.active_trace_topology_gz as t1
                   INNER JOIN (
             SELECT task_id, max(hop) as hop
             from vnap_data.active_trace_topology_gz
             WHERE end_time >1591080948
             group by task_id
             ) as t2
                  on t1.task_id = t2.task_id
         WHERE end_time >1591080948  and t1.hop<=30 and t1.hop >0 and (t1.hop_ip!=t1.ip) and t1.hop_ip!=t1.src_ip
) as t3
group by value
order by hopIpValue asc;

explain.xlsx

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.