Description
Currently, sort and limit are different physical relational operators, but in some cases, sort combined with a limit can be more effective. For example ORDER BY x LIMIT 1 requires to store only one row and can be processed with O(rowsCount) operations. In general. ORDER BY x LIMIT m requires O(min(rowsCount, m)) memory and have O(rowsCount * ln(min(rowsCount, m))) complexity.
Since Limit node can't be moved below the Exchange node, ORDER BY x LIMIT m clause should produce two nodes: Limit node, with single distribution, and SortWithLimit node, which can be moved below the Exchange node and can reduce network traffic.
Attachments
Issue Links
- duplicates
-
IGNITE-17453 Calcite Engine: ORDER BY Optimization
- Resolved
- is part of
-
IGNITE-12248 Apache Calcite based query execution engine
- Open
- links to