Documentation ¶
Index ¶
- Constants
- func CheckAutoAnalyzeWindow(sctx sessionctx.Context) bool
- func CleanupCorruptedAnalyzeJobsOnCurrentInstance(sctx sessionctx.Context, currentRunningProcessIDs map[uint64]struct{}) error
- func CleanupCorruptedAnalyzeJobsOnDeadInstances(sctx sessionctx.Context) error
- func NeedAnalyzeTable(tbl *statistics.Table, autoAnalyzeRatio float64) (bool, string)
- func NewStatsAnalyze(statsHandle statstypes.StatsHandle, sysProcTracker sysproctrack.Tracker, ...) statstypes.StatsAnalyze
- func RandomPickOneTableAndTryAutoAnalyze(sctx sessionctx.Context, statsHandle statstypes.StatsHandle, ...) bool
Constants ¶
const BatchUpdateAnalyzeJobSQL = `` /* 253-byte string literal not displayed */
BatchUpdateAnalyzeJobSQL is the SQL to update the analyze jobs to `failed` state.
const SelectAnalyzeJobsOnCurrentInstanceSQL = `` /* 165-byte string literal not displayed */
SelectAnalyzeJobsOnCurrentInstanceSQL is the SQL to select the analyze jobs whose state is `pending` or `running` and the update time is more than 10 minutes ago and the instance is current instance.
const SelectAnalyzeJobsSQL = `` /* 143-byte string literal not displayed */
SelectAnalyzeJobsSQL is the SQL to select the analyze jobs whose state is `pending` or `running` and the update time is more than 10 minutes ago.
Variables ¶
This section is empty.
Functions ¶
func CheckAutoAnalyzeWindow ¶
func CheckAutoAnalyzeWindow(sctx sessionctx.Context) bool
CheckAutoAnalyzeWindow determine the time window for auto-analysis and verify if the current time falls within this range. parameters is a map of auto analyze parameters. it is from GetAutoAnalyzeParameters.
func CleanupCorruptedAnalyzeJobsOnCurrentInstance ¶
func CleanupCorruptedAnalyzeJobsOnCurrentInstance( sctx sessionctx.Context, currentRunningProcessIDs map[uint64]struct{}, ) error
CleanupCorruptedAnalyzeJobsOnCurrentInstance cleans up the potentially corrupted analyze job from current instance. Exported for testing.
func CleanupCorruptedAnalyzeJobsOnDeadInstances ¶
func CleanupCorruptedAnalyzeJobsOnDeadInstances( sctx sessionctx.Context, ) error
CleanupCorruptedAnalyzeJobsOnDeadInstances cleans up the potentially corrupted analyze job from dead instances.
func NeedAnalyzeTable ¶
func NeedAnalyzeTable(tbl *statistics.Table, autoAnalyzeRatio float64) (bool, string)
NeedAnalyzeTable checks if we need to analyze the table:
- If the table has never been analyzed, we need to analyze it.
- If the table had been analyzed before, we need to analyze it when "tbl.ModifyCount/tbl.Count > autoAnalyzeRatio" and the current time is between `start` and `end`.
Exposed for test.
func NewStatsAnalyze ¶
func NewStatsAnalyze( statsHandle statstypes.StatsHandle, sysProcTracker sysproctrack.Tracker, ddlNotifier *notifier.DDLNotifier, ) statstypes.StatsAnalyze
NewStatsAnalyze creates a new StatsAnalyze.
func RandomPickOneTableAndTryAutoAnalyze ¶
func RandomPickOneTableAndTryAutoAnalyze( sctx sessionctx.Context, statsHandle statstypes.StatsHandle, sysProcTracker sysproctrack.Tracker, autoAnalyzeRatio float64, pruneMode variable.PartitionPruneMode, start, end time.Time, ) bool
RandomPickOneTableAndTryAutoAnalyze randomly picks one table and tries to analyze it. 1. If the table is not analyzed, analyze it. 2. If the table is analyzed, analyze it when "tbl.ModifyCount/tbl.Count > autoAnalyzeRatio". 3. If the table is analyzed, analyze its indices when the index is not analyzed. 4. If the table is locked, skip it. Exposed solely for testing.
Types ¶
This section is empty.