Building an index flushes the plan cache. If a query which could leverage the new index executes while the background build is still in progress, the query will be planned without the ability to consider the new index as a candidate. This plan can then get cached and there will be no further flushing done as a result of the build process. Further, the index in the cached plan may not be as selective as the newly created one, therefore it may be hard to evict the old plan without manual intervention.
- is related to
-
SERVER-34830 currentOp of replicated createIndexes does not display command name
- Closed
-
SERVER-32452 Replanning may not occur when a plan with an extremely high 'works' value is cached
- Closed
- related to
-
SERVER-43624 Query executing during background index build completion can lead to suboptimal cached plan
- Closed