【问题标题】:Is there a way to identify or detect data skew in Hive table?有没有办法识别或检测 Hive 表中的数据倾斜?
【发布时间】:2023-03-03 21:02:01
【问题描述】:

我们有许多需要花费大量时间的配置单元查询。我们正在使用 tez 和其他良好做法,例如 CBO、使用 orc 文件等。

有没有办法像某些命令一样检查/分析数据倾斜?解释计划有帮助吗?如果有,我应该寻找哪个参数?

【问题讨论】:

    标签: performance hadoop hive hiveql


    【解决方案1】:

    解释计划对此无济于事,您应该检查数据。如果是join,则从所有参与join的表中选择前100个join key值,如果是解析函数,对partition by key做同样的操作,看看是不是skew。

    例子:

    select key, count(*) cnt
       from table
      group by key
     having count(*)> 1000 --check also >1 for tables where it should not be duplication (like dimentions)
      order by cnt desc limit 100;
    

    key 可以是复杂的连接键(您在连接 ON 条件下使用的所有列)。

    也看看这个答案:https://stackoverflow.com/a/51061613/2700344

    【讨论】:

    • 感谢您的指点,我一定会检查并返回。这真的很有帮助。
    猜你喜欢
    • 2013-09-16
    • 2013-09-08
    • 1970-01-01
    • 2014-09-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-25
    • 2019-03-01
    相关资源
    最近更新 更多