【问题标题】:Reduce the execution time of large query减少大查询的执行时间
【发布时间】:2019-02-08 08:27:50
【问题描述】:

我的查询需要 30 多分钟才能处理此查询。它确实适用于非常大的数据集,但是我可能缺少一些可以减少执行时间的基本内容。

查询适用于许多减速器阶段,每个阶段使用 1000 多个减速器。在 Tez 引擎上运行。

我尝试启用 CBO 但没有成功,还尝试将减速器限制为 500 但执行时间仍然很长。

select itt.tr_date, sum (bkt_sum_pc) as pts 
from itops_trxn itt,
( select acttrxnID, max(act_cmp_id) as act_cmp_id 
   from itops_trxn_act a, ll_act_act_trxn b where a.act_trxn_ID = b.ACOUNTtrxnID group by  acttrxnID 
) A, 
(select cmp_id, max (cmp_name) as name 
   from itops_offer group by  cmp_id
) c 
where itt.acttrxnID = A.acttrxnID and act_cmp_id = c.cmp_id
and itt.type = 'ajstmnt' 
and itt.event_header_event_name NOT IN ('composite.sys.act.merge', 'pos.sys.identity', 'composite.sys.act.pcmerge') 
and itt.event_atomic_operation_type  = 'CT'
and itt.tr_date >='2018-10-31' 
group by itt.tr_date, channel, location_storeparentid, meta_trxnreason,  act_cmp_id,name; 

【问题讨论】:

  • 请提供解释输出

标签: hadoop hive hiveql query-performance apache-tez


【解决方案1】:

显式重写连接并移动这些条件

where itt.acttrxnID = A.acttrxnID and act_cmp_id = c.cmp_id

到加入 ON 子句:

select itt.tr_date, sum (bkt_sum_pc) as pts 
from itops_trxn itt
INNER JOIN
( select acttrxnID, max(act_cmp_id) as act_cmp_id 
   from itops_trxn_act a, ll_act_act_trxn b where a.act_trxn_ID = b.ACOUNTtrxnID group by  acttrxnID 
) A           ON itt.acttrxnID = A.acttrxnID
INNER JOIN 
(select cmp_id, max (cmp_name) as name 
   from itops_offer group by  cmp_id
) c           ON A.act_cmp_id = c.cmp_id
where itt.type = 'ajstmnt' 
and itt.event_header_event_name NOT IN ('composite.sys.act.merge', 'pos.sys.identity', 'composite.sys.act.pcmerge') 
and itt.event_atomic_operation_type  = 'CT'
and itt.tr_date >='2018-10-31' 
group by itt.tr_date, channel, location_storeparentid, meta_trxnreason,  act_cmp_id,name; 

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2016-01-29
  • 1970-01-01
  • 2013-10-08
  • 1970-01-01
  • 2015-11-30
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多