Versions in this module Expand all Collapse all v1 v1.0.0 Oct 16, 2017 Changes in this version + const StatsOwnerKey + const StatsPrompt + func FMSketchToProto(s *FMSketch) *tipb.FMSketch + func HistogramToProto(hg *Histogram) *tipb.Histogram + func SampleCollectorToProto(c *SampleCollector) *tipb.SampleCollector + type AnalyzeResult struct + Count int64 + Err error + Hist []*Histogram + IsIndex int + TableID int64 + type Bucket struct + Count int64 + LowerBound types.Datum + Repeats int64 + UpperBound types.Datum + type Column struct + Info *model.ColumnInfo + func (c *Column) String() string + type FMSketch struct + func FMSketchFromProto(protoSketch *tipb.FMSketch) *FMSketch + func NewFMSketch(maxSize int) *FMSketch + func (s *FMSketch) InsertValue(value types.Datum) error + func (s *FMSketch) NDV() int64 + type Handle struct + LastVersion uint64 + Lease time.Duration + PrevLastVersion uint64 + func NewHandle(ctx context.Context, lease time.Duration) *Handle + func (h *Handle) AnalyzeResultCh() chan *AnalyzeResult + func (h *Handle) Clear() + func (h *Handle) DDLEventCh() chan *ddl.Event + func (h *Handle) DeleteTableStatsFromKV(id int64) error + func (h *Handle) DumpStatsDeltaToKV() + func (h *Handle) GetTableStats(tblID int64) *Table + func (h *Handle) HandleAutoAnalyze(is infoschema.InfoSchema) error + func (h *Handle) HandleDDLEvent(t *ddl.Event) error + func (h *Handle) NewSessionStatsCollector() *SessionStatsCollector + func (h *Handle) Update(is infoschema.InfoSchema) error + func (h *Handle) UpdateTableStats(tables []*Table, deletedIDs []int64) + type Histogram struct + Buckets []Bucket + ID int64 + LastUpdateVersion uint64 + NDV int64 + NullCount int64 + func BuildColumn(ctx context.Context, numBuckets, id int64, collector *SampleCollector) (*Histogram, error) + func BuildIndex(ctx context.Context, numBuckets, id int64, records ast.RecordSet) (int64, *Histogram, error) + func HistogramFromProto(protoHg *tipb.Histogram) *Histogram + func MergeHistograms(sc *variable.StatementContext, lh *Histogram, rh *Histogram, bucketSize int) (*Histogram, error) + func (hg *Histogram) SaveToStorage(ctx context.Context, tableID int64, count int64, isIndex int) error + type Index struct + Info *model.IndexInfo + func (idx *Index) String() string + type SampleBuilder struct + ColLen int + MaxBucketSize int64 + MaxSampleSize int64 + MaxSketchSize int64 + PkID int64 + RecordSet ast.RecordSet + Sc *variable.StatementContext + func (s SampleBuilder) CollectSamplesAndEstimateNDVs() ([]*SampleCollector, *SortedBuilder, error) + type SampleCollector struct + Count int64 + IsMerger bool + MaxSampleSize int64 + NullCount int64 + Samples []types.Datum + Sketch *FMSketch + func SampleCollectorFromProto(collector *tipb.SampleCollector) *SampleCollector + func (c *SampleCollector) MergeSampleCollector(rc *SampleCollector) + type SessionStatsCollector struct + func (s *SessionStatsCollector) Delete() + func (s *SessionStatsCollector) Update(id int64, delta int64, count int64) + type SortedBuilder struct + Count int64 + func NewSortedBuilder(sc *variable.StatementContext, numBuckets, id int64) *SortedBuilder + func (b *SortedBuilder) Hist() *Histogram + func (b *SortedBuilder) Iterate(data types.Datum) error + type Table struct + Columns map[int64]*Column + Count int64 + Indices map[int64]*Index + ModifyCount int64 + Pseudo bool + TableID int64 + Version uint64 + func PseudoTable(tableID int64) *Table + func (t *Table) ColumnBetweenRowCount(sc *variable.StatementContext, a, b types.Datum, colInfo *model.ColumnInfo) (float64, error) + func (t *Table) ColumnEqualRowCount(sc *variable.StatementContext, value types.Datum, colInfo *model.ColumnInfo) (float64, error) + func (t *Table) ColumnGreaterRowCount(sc *variable.StatementContext, value types.Datum, colInfo *model.ColumnInfo) (float64, error) + func (t *Table) ColumnIsInvalid(colInfo *model.ColumnInfo) bool + func (t *Table) ColumnLessRowCount(sc *variable.StatementContext, value types.Datum, colInfo *model.ColumnInfo) (float64, error) + func (t *Table) GetRowCountByColumnRanges(sc *variable.StatementContext, colID int64, colRanges []*types.ColumnRange) (float64, error) + func (t *Table) GetRowCountByIndexRanges(sc *variable.StatementContext, idxID int64, indexRanges []*types.IndexRange) (float64, error) + func (t *Table) GetRowCountByIntColumnRanges(sc *variable.StatementContext, colID int64, intRanges []types.IntColumnRange) (float64, error) + func (t *Table) Selectivity(ctx context.Context, exprs []expression.Expression) (float64, error) + func (t *Table) String() string