pingcap / pingcap/tidb

statistics: `analyze table t with 1 buckets` have a logic problem

Open
#65,439 3 comments 0 reactions 1 assignee Claimed by @L-maple View on GitHub
component/statistics contribution severity/moderate sig/planner type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

```
set tidb_analyze_version = 1;
drop table if exists t;
create table t (a int, b int, c int, index aidx(a));
insert into t values(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(2,2,2),(2,2,2),(2,2,2),(2,2,2),(2,2,2);
analyze table t with 1 buckets;
select * from t where a > 1;
show stats_buckets where table_name = "t" and column_name = "aidx";
```

### 2. What did you expect to see? (Required)
the index's histogram should only have a bucket.

### 3. What did you see instead (Required)
Image

### 4. What is your TiDB version? (Required)
Image

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.