hive - 从子查询/连接的结果中过滤分区时,Hive Query 将进行全表扫描
问题描述
与 Query2 相比,为什么 query1 运行时间更长。
Hive 源表详细信息
Columns - 166
Partitions columns - 2 columns (all are int datatypes)
Number of Partitions - 3211 partitions
Total Records - 19374461064
File Format - ORC
-- 查询1
create table temp1 as
with temp_table1 as
(select col1 from temp_table where col1 between <start_date> and <end_date>), -- these query would get me the dates and there are derived dynamically in the script
select f1.* from sourcetable f1 join temp_table1 f2 on f1.col1=f2.col1;
-- 上述查询运行时间较长,其中一个步骤需要 ~1300 个映射器和 ~1000 个减速器。-- 执行时间 - ~120 分钟
-- 查询2
-- 如果在 where 子句中将 temp table1 的结果作为值传递,则查询将在 10 分钟内检索结果。
select f1.* from source_table where f1.col1 in (value1, value2, value3, value3... value30);
解决方案
推荐阅读
- javascript - 物化 CSS 模态
- opencv - 如何使用 OpenCV 或其他图像库在图像上打印文本而不重叠?
- gatsby - src 作为 gatsby-plugin-image 问题中的道具
- bash - 将文件从不同的目录解压缩到不同的目录
- postgresql-9.1 - postgres 中的 to_char (text) 函数使用哪种格式
- python - 无法使用函数获得正确的结果,包括 Python 上的另一个 excel 作家乐趣
- c# - 如何获取 Xamarin Forms iOS 应用程序的调试版本以引发 XamlParserExceptions?
- google-sheets - 如何使用附加图像中的数据提取员工数据
- r - 有条件地停止突变
- python - 用于 PDF 提取的 Pythons 库 pdfreader 不会迭代槽页面