Push down LIMIT When There Exists GROUP BY without ORDER BY or Any Aggregate Target
Open
needs-review
- Dominant language
- C
- Stars
- 12.8k
- Forks
- 794
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 31
Description
In a SELECT ... LIMIT, we don't push LIMIT down when the query has a GROUP BY but no ORDER BY.
Example Query:
`SELECT repo_id FROM github_events_hash GROUP BY repo_id LIMIT 10;`
Statement on Shards:
`COPY (SELECT repo_id FROM github_events_hash_102016 github_events_hash WHERE true GROUP BY repo_id) TO STDOUT`
We can extend the case where we push the LIMIT down if:
- There is a GROUP BY
- There is no ORDER BY
- There is no Aggregate Target
Contributor guide
Assessment
This issue has not been assessed yet.