`sys.schema_unused_indexes` doesn't work well
Author: YangKeaoCreated Oct 27, 2025Updated Sep 17, 2026
Labelstype/bugsig/sql-infraseverity/majormay-affects-6.5may-affects-7.1may-affects-7.5may-affects-8.1may-affects-8.5
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
CREATE TABLE t (id int primary key, col int unique);
SELECT * FROM sys.schema_unused_indexes;2. What did you expect to see? (Required)
- The rows should include
col; - The rows shouldn't include
primary;
The first is because of some execution issue in tidb coprocessor (but I'm not sure, the plan looks good).
The second is because the primary should be PRIMARY. I should modify it in the view definition.
3. What did you see instead (Required)
It only has one row: primary.
4. What is your TiDB version? (Required)
Source: pingcap/tidb