【问题标题】:Performing effective Joins on many tables in Hive在 Hive 中的许多表上执行有效的联接
【发布时间】:2016-10-18 15:18:12
【问题描述】:

我将加入大约 14 个表以在 Hive 1.2 中创建基表。每个表都有数百万条记录,这些是执行查询时使用的参数

hive.exec.dynamic.partition=true;  
hive.exec.max.dynamic.partitions.pernode=200000;  
hive.exec.max.dynamic.partitions=200000;  
hive.exec.max.created.files=250000;  
hive.enforce.bucketing=true;  
hive.auto.convert.join=false;  
mapreduce.map.memory.mb=8192;  
mapreduce.reduce.memory.mb=8192;  
mapred.reduce.child.java.opts=-Xmx8096m;  
mapred.map.child.java.opts=-Xmx8096m;  
hive.exec.dynamic.partition.mode=nonstrict;   

我正在使用 ORC 文件格式,并根据 ID 对表进行分桶,并根据年、季度和月对表进行分区。该表显然在连接方面执行了大量计算。请让我知道任何其他参数或执行可用于更有效地执行连接的不同策略

【问题讨论】:

    标签: hadoop join optimization hive query-optimization


    【解决方案1】:

    您还可以查看源表中文件和文件块的大小。完成的每个连接基本上都是针对每个文件块完成的,因此增加文件/块的大小意味着需要进行的连接更少。另一方面,更大的文件/块意味着更少的并行化,因此需要进行一些测试才能找到正确的平衡。您可以通过使用以下设置进行小文件合并来调整块大小。这些设置还将为每个文件生成 1 个块,这在大多数情况下非常适合性能。

    -- config settings to be added to the DML that loads your source tables
    -- these will merge the files into 500MB files with only one block per file
    -- as long as the block size is set higher than the file size then only one block will be produced
    set hive.merge.smallfiles.avgsize = 524288000;
    set dfs.block.size = 1073741824;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-31
      • 1970-01-01
      • 2016-07-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多