Skip to main content

What is the role of index filters?

Senior MongoDB
Quick Answer Index filters let you specify which indexes the planner can use for a given query shape, overriding the planner's automatic choice. Set with planCacheSetFilter. Useful when the planner consistently picks a suboptimal plan and query hints aren't practical. More persistent than hints (survive restarts in MongoDB 6+). Use sparingly - usually fixing the query or index design is better.

Answer

Index filters restrict query planner index usage, helping force specific indexes for performance tuning.
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