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

Inconsistent row count estimation between lite stats init and non-lite init when table has no stats #52426

Closed
winoros opened this issue Apr 8, 2024 · 1 comment · Fixed by #52427
Labels
affects-8.1 This bug affects the 8.1.x(LTS) versions. severity/moderate sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@winoros
Copy link
Member

winoros commented Apr 8, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create a small table and insert some rows

create table t(a int);
insert into t values(1), (2), (3), (4), (5), (6), (7), (8), (9), (10);

Wait for a while after the stats delta is updated.
image

Then run explain select * from t where a in (1, 2, 3, 4, 5, 6,7,8) with and without setting lite-init-stats in config to false(default is true).

2. What did you expect to see? (Required)

Estimation is the same, both is 0.08 while the full scan is 10. (0.08 = 10 * 1/1000 * 8)

3. What did you see instead (Required)

The lite init got
image
8 = 10 * 0.8(defaultSelectivityFactor)

4. What is your TiDB version? (Required)

current master.

@winoros
Copy link
Member Author

winoros commented Apr 8, 2024

only master is affected and it should be introduced by #52294.
The normal filters like >=, <=, = will not be affected. The IN function is affected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-8.1 This bug affects the 8.1.x(LTS) versions. severity/moderate sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant