Documentation
¶
Index ¶
- func SetStatisticsTableCache(id int64, statsTbl *Table, version uint64)
- type Builder
- type Column
- func (c *Column) BetweenRowCount(sc *variable.StatementContext, a, b types.Datum) (int64, error)
- func (c *Column) EqualRowCount(sc *variable.StatementContext, value types.Datum) (int64, error)
- func (c *Column) GreaterRowCount(sc *variable.StatementContext, value types.Datum) (int64, error)
- func (c *Column) LessRowCount(sc *variable.StatementContext, value types.Datum) (int64, error)
- func (c *Column) String() string
- type FMSketch
- type Handle
- type Table
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetStatisticsTableCache ¶
SetStatisticsTableCache sets the statistics table cache.
Types ¶
type Builder ¶
type Builder struct { Ctx context.Context // Ctx is the context. TblInfo *model.TableInfo // TblInfo is the table info of the table. StartTS int64 // StartTS is the start timestamp of the statistics table builder. Count int64 // Count is the total rows in the table. NumBuckets int64 // NumBuckets is the number of buckets a column histogram has. ColumnSamples [][]types.Datum // ColumnSamples is the sample of columns. ColOffsets []int // ColOffsets is the offset of columns in the table. IdxRecords []ast.RecordSet // IdxRecords is the record set of index columns. IdxOffsets []int // IdxOffsets is the offset of indices in the table. PkRecords ast.RecordSet // PkRecords is the record set of primary key of integer type. PkOffset int // PkOffset is the offset of primary key of integer type in the table. }
Builder describes information needed by NewTable
type Column ¶
type Column struct { ID int64 // Column ID. NDV int64 // Number of distinct values. // Histogram elements. // // A bucket number is the number of items stored in all previous buckets and the current bucket. // bucket numbers are always in increasing order. // // A bucket value is the greatest item value stored in the bucket. // // Repeat is the number of repeats of the bucket value, it can be used to find popular values. // // TODO: We could have make a bucket struct contains number, value and repeats. Numbers []int64 Values []types.Datum Repeats []int64 }
Column represents statistics for a column.
func (*Column) BetweenRowCount ¶
BetweenRowCount estimates the row count where column greater or equal to a and less than b.
func (*Column) EqualRowCount ¶
EqualRowCount estimates the row count where the column equals to value.
func (*Column) GreaterRowCount ¶
GreaterRowCount estimates the row count where the column greater than value.
func (*Column) LessRowCount ¶
LessRowCount estimates the row count where the column less than value.
type FMSketch ¶
type FMSketch struct {
// contains filtered or unexported fields
}
FMSketch is used to count the number of distinct elements in a set.
type Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
Handle can update stats info periodically.
func (*Handle) Update ¶
func (h *Handle) Update(is infoschema.InfoSchema) error
Update reads stats meta from store and updates the stats map.
type Table ¶
type Table struct { Info *model.TableInfo Columns []*Column Indices []*Column Count int64 // Total row count in a table. Pseudo bool }
Table represents statistics for a table.
func GetStatisticsTableCache ¶
GetStatisticsTableCache retrieves the statistics table from cache, and the cache will be updated by a goroutine.
func PseudoTable ¶
PseudoTable creates a pseudo table statistics when statistic can not be found in KV store.
func TableStatsFromStorage ¶
TableStatsFromStorage loads table stats info from storage.
func (*Table) SaveToStorage ¶
SaveToStorage saves stats table to storage.