cockroachdb / cockroachdb/cockroach
sql/stats: forecast closer to the current time
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
Pulling out [this comment](https://github.com/cockroachdb/cockroach/issues/119967#issuecomment-1985109828) into a separate issue. We should try to pick a forecast time closer to the current time.
> I think both this and https://github.com/cockroachlabs/support/issues/2792 are strong arguments for picking something closer to the current time for the forecast, rather than the predicted time of the next automatic statistics collection. I've resisted doing this because it makes forecasts nondeterministic, but I think there are ways we could reduce the pain of nondeterminism:
>
> 1. round the current time down to the nearest hour / minute / some known interval, and use this for the forecast time, to get pseudo-determinism
> 2. for AOST queries use the calculated txn time instead of the current time
> 3. log changes in forecasts if they're significant, or plot them in some time-series chart
> 4. add a time to SHOW STATISTICS WITH FORECAST so that we can see what was happening at a certain time
> 5. add current forecasts to statement diagnostics bundles
Also see these slack threads:
- https://cockroachlabs.slack.com/archives/C01RX2G8LT1/p1705421378616609
- https://cockroachlabs.slack.com/archives/G01R3EYPQKA/p1709587805437729
- https://cockroachlabs.slack.com/archives/G01R3EYPQKA/p1726164326086669
Jira issue: CRDB-42187
Contributor guide
Assessment
This issue has not been assessed yet.