Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions best-practices/index-management-best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ By using `CLUSTER_TIDB_INDEX_USAGE`, you can gain a global perspective on index

## Identify unused indexes using `schema_unused_indexes`

Manually analyzing index usage data can be time-consuming. To simplify this process, TiDB provides [`schema_unused_indexes`](/sys-schema/sys-schema-unused-indexes.md), a system view that lists indexes that have not been used since the database is last restarted.
Manually analyzing index usage data can be time-consuming. To simplify this process, TiDB provides [`schema_unused_indexes`](/sys-schema/sys-schema-unused-indexes.md), a system view that lists indexes that have not been accessed on any TiDB instance since that instance's last restart.

This provides a quick way for you to do the following:

Expand All @@ -179,7 +179,7 @@ By using `schema_unused_indexes`, you can quickly identify unnecessary indexes a

### How `schema_unused_indexes` works

The `schema_unused_indexes` view is derived from `TIDB_INDEX_USAGE`, meaning it automatically filters out indexes that have recorded zero query activity since the last TiDB restart.
The `schema_unused_indexes` view is derived from `CLUSTER_TIDB_INDEX_USAGE`, meaning it automatically extracts indexes that have not been accessed on any TiDB instance since that instance's last restart.
Comment thread
coderabbitai[bot] marked this conversation as resolved.

To retrieve a list of unused indexes, run the following SQL statement:

Expand All @@ -202,7 +202,7 @@ A result similar to the following is returned:

Take the following points into consideration when you use `schema_unused_indexes`.

#### Indexes are considered unused only since the last restart
#### Indexes are considered unused only since each TiDB instance's last restart

- If a TiDB node restarts, the usage tracking data is reset.
- Ensure the system has been running long enough to capture a representative workload before relying on this data.
Expand Down
Loading