<!-- llms-explorer concept facts · https://llms-explorer.com/tree/hidden-indexes-as-a-safe-drop-trial/ · pack 2026-10-30 · ~986 tokens -->

# Hidden indexes as a safe drop trial

> Source-anchored research for Hidden indexes as a safe drop trial. Run status: COMPLETED.

Parent: [Unused index detection with $indexStats](https://llms-explorer.com/tree/unused-index-detection-with-indexstats/) · 4 facets · 12 facts · page: https://llms-explorer.com/tree/hidden-indexes-as-a-safe-drop-trial/

## 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](https://www.mongodb.com/docs/manual/core/index-hidden.md)

## 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](https://www.mongodb.com/docs/manual/core/index-hidden.md)
- 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](https://www.mongodb.com/docs/manual/core/index-hidden.md)

## 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](https://www.mongodb.com/docs/manual/core/index-hidden.md)
- 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](https://www.mongodb.com/docs/manual/core/index-hidden.md)

## 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](https://www.mongodb.com/docs/manual/core/index-hidden.md)
- 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](https://www.mongodb.com/docs/manual/core/index-hidden.md)
- 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](https://www.mongodb.com/community/forums/t/hiding-index-replication-ops-manager/270730)
- 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](https://github.com/saqibameen86/mdbkit)
- 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](https://www.mongodb.com/docs/manual/core/index-hidden.md)
- 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](https://www.mongodb.com/docs/manual/core/index-hidden.md)
- MongoDB does not allow hiding the _id index. (high confidence) — [source](https://www.mongodb.com/docs/manual/core/index-hidden.md)
