Documentation ¶
Index ¶
- Constants
- type Handle
- func (h *Handle) Clear()
- func (h *Handle) Close()
- func (h *Handle) FlushStats()
- func (h *Handle) GetPartitionStats(tblInfo *model.TableInfo, pid int64) *statistics.Table
- func (h *Handle) GetPartitionStatsForAutoAnalyze(tblInfo *model.TableInfo, pid int64) *statistics.Table
- func (h *Handle) GetTableStats(tblInfo *model.TableInfo) *statistics.Table
- func (h *Handle) GetTableStatsForAutoAnalyze(tblInfo *model.TableInfo) *statistics.Table
- func (h *Handle) InitStats(ctx context.Context, is infoschema.InfoSchema) (err error)
- func (h *Handle) InitStatsLite(ctx context.Context) (err error)
- func (h *Handle) StartWorker()
- type MaxTidRecord
Constants ¶
const ( // StatsOwnerKey is the stats owner path that is saved to etcd. StatsOwnerKey = "/tidb/stats/owner" // StatsPrompt is the prompt for stats owner manager. StatsPrompt = "stats" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handle ¶
type Handle struct { // Pool is used to get a session or a goroutine to execute stats updating. util.Pool // AutoAnalyzeProcIDGenerator is used to generate auto analyze proc ID. util.AutoAnalyzeProcIDGenerator // LeaseGetter is used to get stats lease. util.LeaseGetter // TableInfoGetter is used to fetch table meta info. util.TableInfoGetter // StatsGC is used to GC stats. types.StatsGC // StatsUsage is used to track the usage of column / index statistics. types.StatsUsage // StatsHistory is used to manage historical stats. types.StatsHistory // StatsAnalyze is used to handle auto-analyze and manage analyze jobs. types.StatsAnalyze // StatsSyncLoad is used to load stats syncly. types.StatsSyncLoad // StatsReadWriter is used to read/write stats from/to storage. types.StatsReadWriter // StatsLock is used to manage locked stats. types.StatsLock // StatsGlobal is used to manage global stats. types.StatsGlobal // DDL is used to handle ddl events. types.DDL InitStatsDone chan struct{} // StatsCache ... types.StatsCache // contains filtered or unexported fields }
Handle can update stats info periodically.
func NewHandle ¶
func NewHandle( _, initStatsCtx sessionctx.Context, lease time.Duration, is infoschema.InfoSchema, pool pkgutil.SessionPool, tracker sysproctrack.Tracker, ddlNotifier *notifier.DDLNotifier, autoAnalyzeProcIDGetter func() uint64, releaseAutoAnalyzeProcID func(uint64), ) (*Handle, error)
NewHandle creates a Handle for update stats.
func (*Handle) FlushStats ¶
func (h *Handle) FlushStats()
FlushStats flushes the cached stats update into store.
func (*Handle) GetPartitionStats ¶
GetPartitionStats retrieves the partition stats from cache. TODO: remove GetTableStats later on.
func (*Handle) GetPartitionStatsForAutoAnalyze ¶
func (h *Handle) GetPartitionStatsForAutoAnalyze(tblInfo *model.TableInfo, pid int64) *statistics.Table
GetPartitionStatsForAutoAnalyze is to get partition stats but it will not return pseudo stats.
func (*Handle) GetTableStats ¶
func (h *Handle) GetTableStats(tblInfo *model.TableInfo) *statistics.Table
GetTableStats retrieves the statistics table from cache, and the cache will be updated by a goroutine. TODO: remove GetTableStats later on.
func (*Handle) GetTableStatsForAutoAnalyze ¶
func (h *Handle) GetTableStatsForAutoAnalyze(tblInfo *model.TableInfo) *statistics.Table
GetTableStatsForAutoAnalyze is to get table stats but it will not return pseudo stats.
func (*Handle) InitStats ¶
func (h *Handle) InitStats(ctx context.Context, is infoschema.InfoSchema) (err error)
InitStats initiates the stats cache. 1. Basic stats meta data is loaded.(count, modify count, etc.) 2. Column/index stats are loaded. (histogram, topn, buckets, FMSketch)
func (*Handle) InitStatsLite ¶
InitStatsLite initiates the stats cache. The function is liter and faster than InitStats. 1. Basic stats meta data is loaded.(count, modify count, etc.) 2. Column/index stats are loaded. (only histogram) 3. TopN, Bucket, FMSketch are not loaded.
func (*Handle) StartWorker ¶
func (h *Handle) StartWorker()
StartWorker starts the background collector worker inside
type MaxTidRecord ¶
type MaxTidRecord struct {
// contains filtered or unexported fields
}
MaxTidRecord is to record the max tid.