hive中not in优化
生活随笔
收集整理的這篇文章主要介紹了
hive中not in优化
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
比如:A,B兩表,找到ID字段中,存在A表,但不存在B表的數據。
????????? A表共13w,去重后3w,
????????? B表共2W,且有索引
方法一
not in,易理解,效率低,時間:1.395s
select distinct A.id from A where A.id not in(select id from B)方法二
left...join...on ,B.id isnull??? 時間:0.739s
select A.ID from A left join B on A.ID=B.ID where B.ID is null方法三
效率高,
select * from A where (select count(1) as num from B where A.ID = B.ID) = 0轉載于:https://www.cnblogs.com/starzy/p/11146056.html
總結
以上是生活随笔為你收集整理的hive中not in优化的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ios开发网络篇—HTTP协议 - 转
- 下一篇: 显示器尺寸对照表_常见像素和显示屏大小对