Allow Pinning Query Plan Cache Key to a Fixed Plan for a Given Query Shape Hash
Allow Pinning Query Plan Cache Key to a Fixed Plan for a Given Query Shape Hash
n MongoDB 8.0, the new setQuerySettings command allows administrators to enforce index hints and other behavior based on the query shape hash. This gives users partial control over query plan selection.
However, the current implementation still allows the optimizer to re-evaluate multiple plans under certain conditions (e.g., plan cache eviction, plan ranking strategy). Additionally, the planCacheKey, which is the actual determinant for plan reuse, is generated based on more granular factors than the query shape hash (e.g., sort, collation, or exact index hint details).
This FR proposes an extension to the query settings system to allow a user to pin a planCacheKey to a specific query shape hash, effectively enabling full plan determinism.
