Hidden indexes as a safe drop trial
Parent: Unused index detection with $indexStats · Published reference · snapshot 2026-10-30
↓ Facts as markdownall context files
Source-anchored research for Hidden indexes as a safe drop trial. Run status: COMPLETED.
These notes link each claim to its source. Some citations identify archived research reports that are no longer hosted on this site. A published reference means the content is available; it does not certify independent review or accuracy.Read the editorial policy and follow the sources before relying on a claim.
How it works
- Because MongoDB maintains a hidden index, unhiding makes it immediately available for query planning without rebuilding it. Availability does not imply the planner will necessarily select it. (high confidence) [source]
How-to and procedures
- Use db.collection.hideIndex(indexName) and db.collection.unhideIndex(indexName) for the trial and rollback. Inspect db.collection.getIndexes() to verify hidden:true; the hidden field is omitted when the index is unhidden. (medium confidence) [source]
- Use db.collection.hideIndex("index_name") to hide an existing index and db.collection.unhideIndex("index_name") to restore planner eligibility; hideIndex is a mongosh wrapper around collMod with index.hidden. Verify the hidden flag with getIndexes(). (high confidence) [source]
Problems, failure modes and limitations
- Hiding preserves unique constraints and TTL expiration. Consequently, a successful query-performance trial cannot establish the consequences of removing these enforcement or expiration behaviors. (high confidence) [source]
- Queries cannot use cursor.hint() to select a hidden index; operations that hint it return an exception. Check application hints before hiding a candidate index. (high confidence) [source]
Facts and statements
- A hidden index is excluded from query-plan selection. Hiding an existing index therefore tests workload behavior without that access path while preserving a reversible alternative to dropping and rebuilding the index. (high confidence) [source]
- Hidden indexes remain updated by collection writes and consume disk space and memory. A hide trial evaluates plan selection; it does not measure the write-performance or storage savings of actually removing the index. (high confidence) [source]
- Choose an observation window that includes infrequent workloads. A 2024 practitioner thread described jobs that used candidate indexes only once every three months, illustrating why a short quiet trial can miss a dependency. (low confidence) [source]
- As a concrete tooling example, mdbkit prints reversible hideIndex commands for index candidates and warns that an index used monthly can look unused after a week of observation. (low confidence) (verified as of 2026-10-30) [source]
- Before hiding, compare query behavior with the index available; then hide it and compare query performance and plans. If performance regresses, unhide it. This is a reversible experiment that can still expose the application to degraded query performance during the trial. (high confidence) [source]
- Changing an index from visible to hidden resets its $indexStats. Capture usage evidence before starting the trial; do not treat post-hide statistics as an uninterrupted historical baseline. (high confidence) [source]
- MongoDB does not allow hiding the _id index. (high confidence) [source]
Children
- No children recorded.