Skip to main content

What is a plan cache eviction and when does it happen?

Senior MongoDB
Quick Answer Plan cache eviction happens when: the collection's data distribution changes significantly (index stats become stale), the index is dropped, the collection is rebuilt, or MongoDB restarts. After eviction, the planner re-evaluates all candidate plans next time the query runs. Unexpected plan cache evictions can cause sudden performance changes as a previously good plan is reevaluated.

Answer

Plan cache evicts entries after metadata changes or when query patterns deviate significantly, forcing re-evaluation of plans.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice