Repository navigation
STATISTICS shows the indexes that are not PUBLIC #60430
Copy link
Copy link
Closed
Labels
affects-6.5This bug affects the 6.5.x(LTS) versions.This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.This bug affects the 8.1.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.This bug affects the 8.5.x(LTS) versions.component/ddlThis issue is related to DDL of TiDB.This issue is related to DDL of TiDB.severity/majorsig/plannerSIG: PlannerSIG: Plannertype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
mysql> SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE `TABLE_NAME` = 'part' and index_name = 'idx_mfgr';
+---------------+--------------+------------+------------+--------------+------------+--------------+-------------+-----------+-------------+----------+--------+----------+------------+---------+---------------+------------+------------+
| TABLE_CATALOG | TABLE_SCHEMA | TABLE_NAME | NON_UNIQUE | INDEX_SCHEMA | INDEX_NAME | SEQ_IN_INDEX | COLUMN_NAME | COLLATION | CARDINALITY | SUB_PART | PACKED | NULLABLE | INDEX_TYPE | COMMENT | INDEX_COMMENT | IS_VISIBLE | Expression |
+---------------+--------------+------------+------------+--------------+------------+--------------+-------------+-----------+-------------+----------+--------+----------+------------+---------+---------------+------------+------------+
| def | test | part | 1 | test | idx_mfgr | 1 | P_MFGR | A | 0 | NULL | NULL | | BTREE | | | YES | NULL |
+---------------+--------------+------------+------------+--------------+------------+--------------+-------------+-----------+-------------+----------+--------+----------+------------+---------+---------------+------------+------------+
1 row in set (0.00 sec)
mysql>
mysql> admin show ddl jobs;
+--------+---------+------------+---------------------------+----------------------+-----------+----------+-----------+---------------------+---------------------+---------------------+-----------+
| JOB_ID | DB_NAME | TABLE_NAME | JOB_TYPE | SCHEMA_STATE | SCHEMA_ID | TABLE_ID | ROW_COUNT | CREATE_TIME | START_TIME | END_TIME | STATE |
+--------+---------+------------+---------------------------+----------------------+-----------+----------+-----------+---------------------+---------------------+---------------------+-----------+
| 140 | test | part | add index /* txn-merge */ | write reorganization | 2 | 84 | 1323005 | 2025-04-08 05:31:13 | 2025-04-08 05:31:13 | NULL | running |
| 139 | test | part | drop index | none | 2 | 84 | 0 | 2025-04-08 05:23:10 | 2025-04-08 05:23:10 | 2025-04-08 05:23:10 | synced |
| 138 | test | part | add index /* txn-merge */ | public | 2 | 84 | 1600000 | 2025-04-05 15:17:09 | 2025-04-05 15:17:09 | 2025-04-05 15:17:50 | synced |
| 137 | test | part | drop index | none | 2 | 84 | 0 | 2025-04-05 15:16:30 | 2025-04-05 15:16:30 | 2025-04-05 15:16:31 | synced |
| 136 | test | part | add index /* txn-merge */ | public | 2 | 84 | 1600000 | 2025-04-05 15:12:35 | 2025-04-05 15:12:35 | 2025-04-05 15:13:16 | synced |
| 135 | test | part | drop index | none | 2 | 84 | 0 | 2025-04-05 15:11:36 | 2025-04-05 15:11:36 | 2025-04-05 15:11:36 | synced |
| 134 | test | part | add index | none | 2 | 84 | 0 | 2025-04-05 05:34:29 | 2025-04-05 05:35:09 | 2025-04-05 05:35:09 | cancelled |
| 133 | test | part | add index /* txn-merge */ | public | 2 | 84 | 1600000 | 2025-04-05 05:34:29 | 2025-04-05 05:34:29 | 2025-04-05 05:35:09 | synced |
| 132 | test | part | drop index | public | 2 | 84 | 0 | 2025-04-05 05:34:29 | 2025-04-05 05:34:29 | 2025-04-05 05:34:29 | cancelled |
| 131 | test | part | drop index | none | 2 | 84 | 0 | 2025-04-05 05:34:29 | 2025-04-05 05:34:29 | 2025-04-05 05:34:29 | synced |
| 130 | test | t | drop table | none | 2 | 128 | 0 | 2025-04-05 05:30:30 | 2025-04-05 05:30:30 | 2025-04-05 05:30:30 | synced |
+--------+---------+------------+---------------------------+----------------------+-----------+----------+-----------+---------------------+---------------------+---------------------+-----------+
11 rows in set (0.01 sec)
mysql>
mysql> select version();
+---------------------+
| version() |
+---------------------+
| 5.7.25-TiDB-v6.5.11 |
+---------------------+
1 row in set (0.00 sec)
2. What did you expect to see? (Required)
STATISTICS doesn't show the indexes that are not PUBLIC
3. What did you see instead (Required)
STATISTICS shows the indexes that are not PUBLIC
4. What is your TiDB version? (Required)
v6, v7
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
affects-6.5This bug affects the 6.5.x(LTS) versions.This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.This bug affects the 8.1.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.This bug affects the 8.5.x(LTS) versions.component/ddlThis issue is related to DDL of TiDB.This issue is related to DDL of TiDB.severity/majorsig/plannerSIG: PlannerSIG: Plannertype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.
Activity
hawkingrei commentedon Apr 8, 2025
In the
setDataForStatisticsInTable, we don't check the public status of the table. so we can add the check to fix this problem.executor: filter non-public indexes for I_S.statistics (#61285)
executor: filter non-public indexes for I_S.statistics (#61285) (#62038)
executor: filter non-public indexes for I_S.statistics (#61285) (#62036)