当前位置: 首页 > news >正文

成都网站模板购买实战直播

成都网站模板购买,实战直播,网站设计联系方式,做网站登录分析&回答 Hive 大表和小表的关联 优先选择将小表放在内存中。小表不足以放到内存中,可以通过bucket-map-join(不清楚的话看底部文章)来实现,效果很明显。 两个表join的时候,其方法是两个join表在join key上都做hash bucket&#xff0c…

分析&回答

Hive 大表和小表的关联

  • 优先选择将小表放在内存中。
  • 小表不足以放到内存中,可以通过bucket-map-join(不清楚的话看底部文章)来实现,效果很明显。
    • 两个表join的时候,其方法是两个join表在join key上都做hash bucket,并且把你打算复制的那个(相对)小表的bucket数设置为大表的倍数。这样数据就会按照key join,做hash bucket。
    • 小表依然复制到所有节点,Map join的时候,小表的每一组bucket加载成hashtable,与对应的一个大表bucket做局部join,这样每次只需要加载部分hashtable就可以了。
    • set hive.optimize.bucketmapjoin = true;
    • 注意:如果表不是bucket的,则只是做普通join。

Spark 大表和小表的关联

采用了BroadcastHashJoin广播小表,但必须满足两个条件:

  1. 表的统计信息是否正确,也就是你要让执行计划知道你是小表,这一条我看基本上99%的文章都没有告诉你,这也是我折腾两天才发现的,我发现了就想告诉大家。我想起做MPP数据库跑批结束都会要求收集统计信息才想到的。
  2. 广播的表数据量小于spark.sql.autoBroadcastJoinThreshold值,这一条几乎所有文章都说了。 InMemoryTableScan , 除了占用内存外,效率是极高
    Spark 中 执行hive table scan操作,返回的MapPartitionsRDD对其重新定义mapPartition方法,将其行转列,并且最终cache到内存中。

MySQL 大表和小表的关联

MySQL 中一般使用 left outer join的左表必须是大表

反思&扩展

left join和left outer join的区别

left join是left outer join的缩写,所以作用是一样的。另外在SQL里没有区分大小写,也就是left join和LEFT JOIN都是可以的。

  • left join: 包含左表的所有行,对应的右表行可能为空。
  • right join: 包含右表的所有行,对应的左表行可能为空。
  • full join: 只包含左右表都匹配并且不为空的行。

Introduction to Bucket Map Join

In Apache Hive, while the tables are large and all the tables used in the join are bucketed on the join columns we use Hive Bucket Map Join feature. Moreover, one table should have buckets in multiples of the number of buckets in another table in this type of join.

How Bucket Map Join Works

Let’s understand with an example. For suppose if one table has 2 buckets then the other table must have either 2 buckets or a multiple of 2 buckets (2, 4, 6, and so on). Further, since the preceding condition is satisfied then the joining can be done on the mapper side only.

Else a normal inner join is performed. Therefore, it implies that only the required buckets are fetched on the mapper side and not the complete table.

Hence, onto each mapper, only the matching buckets of all small tables are replicated. As a result of this, the efficiency of the query improves drastically. However, make sure data does not sort in a bucket map join.

Also, note that by default Hive does not support a bucket map join. So, we need to set the following property  to true for the query to work as this join:

set hive.optimize.bucketmapjoin = true

喵呜面试助手:一站式解决面试问题,你可以搜索微信小程序 [喵呜面试助手] 或关注 [喵呜刷题] -> 面试助手 免费刷题。如有好的面试知识或技巧期待您的共享!

http://www.yayakq.cn/news/698730/

相关文章:

  • 泰州网站制作专业wordpress360
  • 外贸网站搭建一站式服务网络销售怎么做
  • 绿植网站怎么做新网站建设教程
  • 网站seo注意事项做网站工作怀孕
  • 企业网站建站意义哪里网站开发好
  • 有用建站宝盒做网站的吗做网站含营销
  • 大良网站公司贵阳酒店网站建设
  • 农安县建设局网站cms企业网站
  • 坊网站建设做二手衣服的网站
  • 中国怎么样做跨境网站免费自助建站哪个最好
  • 无锡做装修网站能源与动力工程
  • 家乡网站策划书建设背景青岛网站建设好不好
  • 网站建设评审标准在线制作diy电子印章
  • 上海网站建设找缘魁汕头网站推广优化
  • vuejs 网站开发企业推广语句
  • 网页制作如何新建站点注册网址的网站
  • 网站竞品拦截广告怎么做网站开发工具书
  • 网站建设服务目标手机app模板免费下载
  • 网页版淘宝北京网站seo收费标准
  • 化妆培训网站模板有哪些电商网站
  • 简单企业网站建设三门峡市建设局官方网站
  • 用手机怎样免费做网站二维码页面设计模板
  • 建设银行荆门招聘网站中小型企业局域网设计方案
  • 做网站的 视频深圳十大建筑设计院
  • 沈阳男科医院好排行seo对各类网站的作用
  • 做高仿表网站维护公司网站建设
  • 做书封面的模板下载网站怎么免费创造自己的网址
  • 网站 数据库 模板网站会员系统wordpress
  • 清苑建设局网站中国建筑集团有限公司是国企吗
  • 网站不良正能量直接进入数码设计网站