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

add index row count doesn't match the actual row count #25968

Closed
crazycs520 opened this issue Jul 5, 2021 · 3 comments · Fixed by #36716
Closed

add index row count doesn't match the actual row count #25968

crazycs520 opened this issue Jul 5, 2021 · 3 comments · Fixed by #36716
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. sig/sql-infra SIG: SQL Infra type/enhancement The issue or PR belongs to an enhancement.

Comments

@crazycs520
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t (id bigint key,b int);
split table t by (10),(20),(30);
 insert into t values (0,0),(10,10),(20,20),(30,30);
alter table t add index idx1(b);
admin show ddl jobs;
select count(*) from t;

image

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

add index row count match the actual row count.

3. What did you see instead (Required)

doesn't match.

4. What is your TiDB version? (Required)

test> select tidb_version()\G
***************************[ 1. row ]***************************
tidb_version() | Release Version: v5.0.2
Edition: Community
Git Commit Hash: dc40a093a0058b95fc859f60d4b84337dbdff9f6
Git Branch: HEAD
UTC Build Time: 2021-07-05 08:12:38
GoVersion: go1.16
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
@crazycs520 crazycs520 added type/bug The issue is confirmed as a bug. priority/P4 Minor issue, awaiting more evidence before prioritizing labels Jul 5, 2021
@zimulala zimulala added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Jul 5, 2021
@wjhuang2016
Copy link
Member

Region:      [0, 10)   [10, 20),  [20, 30),  [30, ...)
Record:         0,          10,      20,        30
------------------------------------------------
startKey: 0 endKey: 30
addIndex Splited KV range(according to region):
[0: 10],  [10, 20], [20, 30]
  2     +     2      +   2          =   6

I found the root cause, but it's not easy to fix it.

@wjhuang2016 wjhuang2016 removed their assignment Jul 27, 2021
@bb7133
Copy link
Member

bb7133 commented Nov 25, 2021

Mark the issue as 'enhancement' because the 'add index row' is now an estimation, it is not accurate by design.

@bb7133 bb7133 added type/enhancement The issue or PR belongs to an enhancement. and removed type/bug The issue is confirmed as a bug. labels Nov 25, 2021
@bb7133 bb7133 removed severity/moderate priority/P4 Minor issue, awaiting more evidence before prioritizing labels Jan 21, 2022
@dcswinner01
Copy link

When will this bug be fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. sig/sql-infra SIG: SQL Infra type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants