pingcap / pingcap/tidb

planner: push StreamAgg down to IndexLookup when no group-by column

Open
#36,769 0 comments 0 reactions 1 assignee Claimed by @qw4990 View on GitHub
sig/planner type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement
When there is no group-by column, the planner should push `StreamAgg` down to `IndexLookup` and generate a plan like:
```
StreamAgg
IndexLookUp
IndexScan
StreamAgg
TableScan
```
Currently, `StreamAgg` cannot be pushed down if there is no `stream_agg()` hint, so we can only get a plan like:
```
StreamAgg
IndexLookUp
IndexScan
TableScan
```
![wivtcusFNZ](https://user-images.githubusercontent.com/7499936/182115521-e78e8068-2667-4ef5-9aae-d754634e0b3d.jpg)

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.