Question About the Estimated Rows in `GROUP BY`
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
The first `SELECT` returns estimated rows 0.67, but the second `SELECT` which has an additional `GROUP BY` clause has bigger number of estimated rows than the first `SELECT`.
### 1. Minimal reproduce step (Required)
```sql
CREATE TABLE t0(c0 BOOL);
INSERT INTO t0 VALUES(TRUE);
ANALYZE TABLE t0;
EXPLAIN SELECT t0.c0 FROM t0 WHERE t0.c0; -- estimated row: 0.67
EXPLAIN SELECT t0.c0 FROM t0 WHERE t0.c0 GROUP BY t0.c0; -- estimated row: 1
```
### 2. What did you expect to see? (Required)
The estimated rows of the first `SELECT` is bigger than the second `SELECT`.
### 3. What did you see instead (Required)
The second one is bigger.
### 4. What is your TiDB version? (Required)
```
| Release Version: None
Edition: Community
Git Commit Hash: 3ef8352a5754606e511ca89292a50612c289a501
Git Branch: None
UTC Build Time: None
GoVersion: go1.19.1
Race Enabled: true
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: unistore |
```
Contributor guide
Assessment
This issue has not been assessed yet.