当前位置:网站首页>Presto中Limit算子的处理过程
Presto中Limit算子的处理过程
2022-06-25 21:32:00 【王飞活】
一. 前言
本文主要探究在Presto中是如何处理Limit算子的。以简单的Hive数据源查询select * from testlimit limit 2为例来探讨在Presto中Limit 2是怎么应用到TableScan的。通过本文可以了解到limit算子下推到Hive数据源的TableScan后,TableScan是如何处理的。
二.带Limit算子的计划执行树
在Presto中,Limit算子在经过RBO优化后会下推到尽可能接近数据源的位置。上边的SQL优化后,最后生成的operator的操作顺序为:

虽然从此图看上去像是TableScan将所有的数据读出来后,再经过Limit过滤,再传给下游。但是在Presto中,实现并不是这样的,因为这样会导致TableScan有相当大的资源消耗从而导致查询效率变慢。
在Presto中,采用的是pipeline的执行模式。也就是说,TableScan每扫到一个Page的数据,就立即送给下游的Limit Operation,Limit Operator操作完之后,也立即送给下游。以此同时,TableScan也会继续扫描下一个page的数据,周而复此。
三. TableScan是如何处理Limit算子的
下边详细描述在Presto中是上边的Limit下推到TableScan后,TableScan是如何处理的。

从上图也可以看出来,在TableScan中,不会将数据全部扫描出来才交给Limit算子,而是一个一个Page扫描,扫描的数据满足大于Limit的个数后,Limit算子就通知TableScan停止扫描了,从未减少扫描的数据量。
边栏推荐
- Ecu-test report converted to excel format
- Basic knowledge of software engineering required for soft test
- Is it safe for qiniu school to open a securities account?
- Set eye color
- Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing Bing
- [important notice] developer document update (12.13-12.19)
- PHP runtime and memory consumption statistics code
- HNU计网实验:实验四 应用层和传输层协议分析(PacketTracer)
- How to write an infinite loop
- 启牛学堂证券开户安全嘛?
猜你喜欢

Support JPEG format in GD Library in php7.4

STM32 self balancing robot project, with code, circuit diagram and other data attached at the end (learning materials and learning group at the end)

Simulate ATM system (account opening, login, account query, withdrawal, deposit, transfer, password modification, account cancellation)

js (1)

熊市指南|一些本质的教训与具体的生存法则

Legal mix of settlements (utf8mb4_0900_ai_ci, implicit) and (utf8mb4_general_ci, implicit) error resolution

Using two stacks to realize the function of one queue?

Jmeter- (I) installation of interface test

01 network basics

Type conversion basis
随机推荐
Shell syntax
Shell scripts: Variables
Openocd compilation and installation
Legal mix of settlements (utf8mb4_0900_ai_ci, implicit) and (utf8mb4_general_ci, implicit) error resolution
On dynamic programming
JS__ Prototype, prototype chain, call/apply__ Duyi
Is it safe for qiniu school to open a securities account?
Common singleton functions traverse dictionary functions
“No bean named ‘UserController‘ available“
The SH runtime directly reported an error syntax error near unexpected token ` $'. \r‘
Jmeter- (I) installation of interface test
CANoe. Diva operation guide TP layer test
lombok
智云健康上市在即:长期亏损,美年健康俞熔已退出,未来难言乐观
Huawei switch stack configuration
"Developer theory" multi system integrated development - rapid nailing of enterprise owned systems
Simulate ATM system (account opening, login, account query, withdrawal, deposit, transfer, password modification, account cancellation)
[nailing - scenario capability package] nailer card
JS__ Inheritance mode, namespace, object enumeration__ Duyi
Writing manuals using markdown