Description
This improvement is to discuss and explore if there is a way for us to automatically re-prepare (i.e. invalidate prepared cache entry plans) either based on plan attributes or configuration.
If for some reason there is an issue with index availability when a statement is prepared, it can be left using a valid but sub-optimal plan without DBA intervention. For example, it may be planned to use a sequential scan (correct for the time of planning) and won't change even when a suitable index is later made available, without manually forcing a repeat of the prepare.
Two ideas thus far are:
- Always mark plans with primary scans (regardless of indexer) as invalidated so they're plans are built on every execution.
- Down-side is that effectively we do away with prepared statements (the benefits thereof) for any primary-scan containing plan with no means to selectively avoid this.
- Would likely need feature control.
- Introduce the concept of a TTL for plans after which they're automatically invalidated and rebuilt.
- TTL would be a cluster configuration defaulting to "infinite" to maintain compatibility with current code.
- Would therefore not need feature control.
- Would apply to all statements.
- TTL would be a cluster configuration defaulting to "infinite" to maintain compatibility with current code.