citusdata / citusdata/citus

Push down LIMIT When There Exists GROUP BY without ORDER BY or Any Aggregate Target

Open
#606 0 comments 0 reactions 1 assignee Claimed by @pykello View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.