Conversation
The sys.schema_unused_indexes view (see sys-schema/sys-schema-unused-indexes.md) is defined as SELECT ... FROM information_schema.cluster_tidb_index_usage ... GROUP BY ... HAVING sum(last_access_time) is null, i.e. it is derived from CLUSTER_TIDB_INDEX_USAGE (which aggregates usage across all TiDB instances), not from the single-instance TIDB_INDEX_USAGE. It also flags an index only once none of the cluster's instances have recorded access since their own last restart, not a single cluster-wide restart event. Found while reviewing the Japanese translation of this file, which faithfully mirrored the inaccurate EN wording. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Warning Review limit reachedNext included review available in 48 minutes. View limit detailsLimit details: You’ve used all 4 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
What is changed, added or deleted? (Required)
best-practices/index-management-best-practices.md's "How schema_unused_indexes works" section said the view is derived fromTIDB_INDEX_USAGEand filters out indexes with zero activity "since the last TiDB restart" (implying a single cluster-wide restart).The actual view definition (see
sys-schema/sys-schema-unused-indexes.md) is:This reads from
CLUSTER_TIDB_INDEX_USAGE(which aggregates usage across all TiDB instances), not from the single-instanceTIDB_INDEX_USAGE. It flags an index as unused only when none of the cluster's instances have recorded access since that instance's own last restart — not a single cluster-wide restart event.Found while reviewing the Japanese translation of this file (which faithfully mirrored the inaccurate EN wording) — flagged by a CodeRabbit review on the JA PR, verified against the real view definition before filing this fix.
Which TiDB version(s) do your changes apply to? (Required)
What is the related PR or file link(s)?
AI agent involvement
Do your changes match any of the following descriptions?
🤖 Generated with Claude Code