A speculative execution policy tells a database driver when to launch another attempt for a request that has not returned. The first successful response wins, so a late original request does not make the application wait for its retry. section 10.5.3
The available policies and settings are:
- NoSpeculativeExecutionPolicy disables speculative retries. section 10.5.3
- ConstantSpeculativeExecutionPolicy waits for a fixed interval, then retries up to a configured number of attempts. section 10.5.3
- Choose the interval from query-performance data; the 99.9th-percentile latency is suggested as a starting point. section 10.5.3
- Use speculative retries selectively: overly aggressive settings create unnecessary duplicate work on cluster nodes. section 10.5.3
Reviews application configuration
A small reviews application can start a speculative retry after 0.1 seconds and allow two attempts. The execution profile applies ConstantSpeculativeExecutionPolicy, while selected idempotent queries are marked individually for speculative retry. section 10.5.3
Figure 10.7 Speculatively retrying queries helps the application mitigate the effects of a query not returning.
A timing diagram shows how a later speculative attempt can return before the original request. section 10.5.3
