Prefilter GROUPBY LIMIT queries#19051
Merged
kaikalur merged 1 commit intoprestodb:masterfrom Feb 17, 2023
Merged
Conversation
5238561 to
c7e4bb4
Compare
mlyublena
reviewed
Feb 14, 2023
presto-main/src/main/java/com/facebook/presto/operator/DistinctLimitOperator.java
Outdated
Show resolved
Hide resolved
mlyublena
reviewed
Feb 14, 2023
presto-main/src/main/java/com/facebook/presto/SystemSessionProperties.java
Outdated
Show resolved
Hide resolved
mlyublena
reviewed
Feb 14, 2023
presto-main/src/main/java/com/facebook/presto/sql/planner/PlannerUtils.java
Outdated
Show resolved
Hide resolved
c7e4bb4 to
18db107
Compare
mlyublena
reviewed
Feb 14, 2023
...main/java/com/facebook/presto/sql/planner/optimizations/PrefilterForLimitingAggregation.java
Outdated
Show resolved
Hide resolved
mlyublena
reviewed
Feb 14, 2023
presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java
Outdated
Show resolved
Hide resolved
mlyublena
reviewed
Feb 14, 2023
presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java
Outdated
Show resolved
Hide resolved
18db107 to
d1bba7e
Compare
mlyublena
approved these changes
Feb 14, 2023
b9f40c5 to
a5e7120
Compare
jainxrohit
reviewed
Feb 15, 2023
presto-main/src/main/java/com/facebook/presto/sql/analyzer/FeaturesConfig.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/sql/analyzer/FeaturesConfig.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/operator/DistinctLimitOperator.java
Outdated
Show resolved
Hide resolved
jainxrohit
reviewed
Feb 15, 2023
presto-main/src/main/java/com/facebook/presto/operator/DistinctLimitOperator.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/operator/DistinctLimitOperator.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/operator/DistinctLimitOperator.java
Outdated
Show resolved
Hide resolved
abceb2f to
f604ef7
Compare
jainxrohit
reviewed
Feb 15, 2023
...main/java/com/facebook/presto/sql/planner/optimizations/PrefilterForLimitingAggregation.java
Outdated
Show resolved
Hide resolved
presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java
Outdated
Show resolved
Hide resolved
presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java
Outdated
Show resolved
Hide resolved
...main/java/com/facebook/presto/sql/planner/optimizations/PrefilterForLimitingAggregation.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/sql/planner/PlannerUtils.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/sql/planner/PlannerUtils.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/sql/planner/PlannerUtils.java
Outdated
Show resolved
Hide resolved
f604ef7 to
6d5aa90
Compare
jainxrohit
approved these changes
Feb 15, 2023
Contributor
|
Can we change commit message to imperative style? |
Contributor
Author
Done |
pranjalssh
approved these changes
Feb 17, 2023
12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We have seen users running ad-hoc queries like:
if the Table has a large number of distinct userid, these queries often OOM or timeout. So we added a new optimization that first tries to scan the table looking for LIMIT number of distinct keys (in a short time like 10s, configurable) and if it finds them, makes a map of those and filters out the original table using that. Roughly:
So the idea is if there are 1000 keys and if we find them quickly then those are returned for quick lookup (prefilter), if not there are no 1000 distinct keys or if we could not find them within the timeout limit, this filter becomes a no-op.
Test plan - AbstractTestQueries