sql/stats: add per-table sql_stats_forecasts_min_goodness_of_fit stor…#169686
Draft
michae2 wants to merge 1 commit intocockroachdb:masterfrom
Draft
sql/stats: add per-table sql_stats_forecasts_min_goodness_of_fit stor…#169686michae2 wants to merge 1 commit intocockroachdb:masterfrom
michae2 wants to merge 1 commit intocockroachdb:masterfrom
Conversation
…age parameter
The cluster setting sql.stats.forecasts.min_goodness_of_fit controls the
minimum R² (goodness of fit) threshold for statistics forecasts, but it
applies cluster-wide. For tables with irregular growth patterns (e.g.
very large tables with 26B+ rows), the default threshold (0.95) can be
too strict, causing useful forecasts to be rejected.
This change adds a per-table storage parameter
`sql_stats_forecasts_min_goodness_of_fit` that overrides the cluster
setting for individual tables:
ALTER TABLE t SET (sql_stats_forecasts_min_goodness_of_fit = 0.80)
The implementation follows the pattern of the existing `forecast_stats`
(ForecastStatsEnabled) table-level override:
- A nullable double field on TableDescriptor (proto field 73)
- A cluster version gate (V26_3_ForecastMinGoodnessOfFitTableSetting)
- The resolved value is threaded through the stats cache alongside the
existing `forecast bool`, and passed as a parameter to
ForecastTableStatistics instead of reading the cluster setting inside
that function.
Release note (sql change): Added per-table storage parameter
`sql_stats_forecasts_min_goodness_of_fit` to override the cluster
setting `sql.stats.forecasts.min_goodness_of_fit` on individual tables.
This allows tuning the forecast goodness-of-fit threshold per table
via `ALTER TABLE t SET (sql_stats_forecasts_min_goodness_of_fit = 0.80)`.
Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
Contributor
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…age parameter
The cluster setting sql.stats.forecasts.min_goodness_of_fit controls the minimum R² (goodness of fit) threshold for statistics forecasts, but it applies cluster-wide. For tables with irregular growth patterns (e.g. very large tables with 26B+ rows), the default threshold (0.95) can be too strict, causing useful forecasts to be rejected.
This change adds a per-table storage parameter
sql_stats_forecasts_min_goodness_of_fitthat overrides the cluster setting for individual tables:The implementation follows the pattern of the existing
forecast_stats(ForecastStatsEnabled) table-level override:forecast bool, and passed as a parameter to ForecastTableStatistics instead of reading the cluster setting inside that function.Release note (sql change): Added per-table storage parameter
sql_stats_forecasts_min_goodness_of_fitto override the cluster settingsql.stats.forecasts.min_goodness_of_fiton individual tables. This allows tuning the forecast goodness-of-fit threshold per table viaALTER TABLE t SET (sql_stats_forecasts_min_goodness_of_fit = 0.80).