Skip to content

analyze primary index statement for clustered index table is not triggered #23230

@lzmhhh123

Description

@lzmhhh123

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table if exists t0;
drop table if exists t1;
create table t0(a varchar(20), primary key(a) clustered);
create table t1(a varchar(20), primary key(a));
insert into t0 values('1111');
insert into t1 values('1111');
analyze table t0 index primary;
analyze table t1 index primary;
show stats_buckets;

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

+---------+------------+----------------+-------------+----------+-----------+-------+---------+-------------+-------------+------+
| Db_name | Table_name | Partition_name | Column_name | Is_index | Bucket_id | Count | Repeats | Lower_Bound | Upper_Bound | Ndv  |
+---------+------------+----------------+-------------+----------+-----------+-------+---------+-------------+-------------+------+
| test    | t0         |                | PRIMARY     |        1 |         0 |     1 |       1 | 1111        | 1111        |    0 |
| test    | t1         |                | PRIMARY     |        1 |         0 |     1 |       1 | 1111        | 1111        |    0 |
+---------+------------+----------------+-------------+----------+-----------+-------+---------+-------------+-------------+------+

3. What did you see instead (Required)

+---------+------------+----------------+-------------+----------+-----------+-------+---------+-------------+-------------+------+
| Db_name | Table_name | Partition_name | Column_name | Is_index | Bucket_id | Count | Repeats | Lower_Bound | Upper_Bound | Ndv  |
+---------+------------+----------------+-------------+----------+-----------+-------+---------+-------------+-------------+------+
| test    | t1         |                | PRIMARY     |        1 |         0 |     1 |       1 | 1111        | 1111        |    0 |
+---------+------------+----------------+-------------+----------+-----------+-------+---------+-------------+-------------+------+

4. What is your TiDB version? (Required)

nightly

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions