Suspicious Estimated Rows by `JOIN`
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
The `CROSS JOIN` returns smaller number of estimated rows than the `LEFT JOIN`.
### 1. Minimal reproduce step (Required)
```sql
CREATE TABLE t0(c0 INT);
INSERT INTO t0 VALUES(1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE VIEW v0(c0, c1, c2) AS SELECT 'a', NULL, t0.c0 FROM t0 GROUP BY DEFAULT(t0.c0) HAVING SUM(1);
ANALYZE TABLE t0;
EXPLAIN SELECT * FROM t0 LEFT JOIN v0 ON v0.c1; -- esimated rows: 10
EXPLAIN SELECT * FROM t0 CROSS JOIN v0; -- esimated rows: 8
```
### 2. What did you expect to see? (Required)
The second `SELECT` returns no smaller number of estimated rows than the first `SELECT`.
### 3. What did you see instead (Required)
The second `SELECT` returns more.
### 4. What is your TiDB version? (Required)
```
| Release Version: v6.4.0-alpha-72-g3ef8352a5
Edition: Community
Git Commit Hash: 3ef8352a5754606e511ca89292a50612c289a501
Git Branch: master
UTC Build Time: 2022-10-14 12:56:17
GoVersion: go1.19.1
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: unistore |
```
Contributor guide
Assessment
This issue has not been assessed yet.