The estRows is inaccurate when there is data skew. #53178
Labels
may-affects-5.4
This bug maybe affects 5.4.x versions.
may-affects-6.1
may-affects-6.5
may-affects-7.1
may-affects-7.5
may-affects-8.1
severity/moderate
sig/planner
SIG: Planner
type/bug
This issue is a bug.
Bug Report
1. Minimal reproduce step (Required)
CREATE TABLE
tb
(id
int(11) NOT NULL,f1
int(11) DEFAULT NULL,f2
int(11) DEFAULT NULL,f3
int(11) DEFAULT NULL,PRIMARY KEY (
id
),KEY
idx_f1
(f1
) ,KEY
idx_f2
(f2
)) partition by hash(id)
(partition
p0
,partition
p1
,partition
p2
);step 1: insert one million records by the following script:
step 2: Insert the following data to construct a data skew
insert into tb (id,f1,f2,f3) values(10000001,10000,102,10000),(20000001,20000,103,20000);
3. Execute analyze table
step 1: analyze table tb;
step 2: analyze table tb update histogram on id,f1,f2;
4. Execute Query
The estRows above is incorrect.
However, what's puzzling is that if we insert 1000 records[Still using the previous script, modifyvariable TOTAL_ROWS to 1000], you will get the correct estRows:
2. What did you expect to see?
3. What did you see instead
4. What is your TiDB version?
pd instance:v8.0.0
tikv instance:v8.0.0
tidb instance:v8.0.0
tiflash instance:v8.0.0
The text was updated successfully, but these errors were encountered: