Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suspicious Estimated Rows by JOIN #38479

Open
bajinsheng opened this issue Oct 14, 2022 · 0 comments
Open

Suspicious Estimated Rows by JOIN #38479

bajinsheng opened this issue Oct 14, 2022 · 0 comments

Comments

@bajinsheng
Copy link

Bug Report

The CROSS JOIN returns smaller number of estimated rows than the LEFT JOIN.

1. Minimal reproduce step (Required)

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 |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants