autoanalyze

package
v1.1.0-beta.0...-cc83417 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const BatchUpdateAnalyzeJobSQL = `` /* 253-byte string literal not displayed */

BatchUpdateAnalyzeJobSQL is the SQL to update the analyze jobs to `failed` state.

View Source
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.

View Source
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:

  1. If the table has never been analyzed, we need to analyze it.
  2. 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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL