Is there a function in TiDB to count indexes that have been created but never used?

This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tidb 有没有函数统计建立了索引而从未被使用过的

| username: tidb狂热爱好者

[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version]
[Encountered Issues]
[Reproduction Path] What operations were performed that led to the issue
[Issue Phenomenon and Impact]
Or you can also count the number of times an index on a table is used
Reverse deduce unused indexes

Please provide the version information of each component, such as cdc/tikv, which can be obtained by executing cdc version/tikv-server --version.

| username: buddyyuan | Original post link

The feature you mentioned can be implemented in version 5.4, but it hasn’t reached GA yet. First, use the tracking column to identify which predicate columns need indexes. Then, compare them with the existing indexes.

| username: h5n1 | Original post link

tidb/docs/design/ at master · pingcap/tidb · GitHub Just wait for future releases. Currently, what can be done is to parse the plan_digest from slow SQL logs, statements_summary, etc., and then perform string matching.

| username: OnTheRoad | Original post link

Not supported for now.