Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
flowbehappy opened this issue Oct 22, 2020 · 0 comments
Assignees
Labels
component/mpp type/enhancement The issue or PR belongs to an enhancement.

Comments

@flowbehappy
Copy link
Contributor

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

@flowbehappy flowbehappy added the type/enhancement The issue or PR belongs to an enhancement. label Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/mpp type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

3 participants