package
9.0.0-alpha+incompatible
Repository: https://github.com/pingcap/tidb.git
Documentation: pkg.go.dev

# Packages

# Functions

BuildColumn builds histogram from samples for column.
BuildColumnHist build a histogram for a column.
BuildExtendedStats build extended stats for column groups if needed based on the column samples.
BuildHistAndTopN build a histogram and TopN for a column or an index from samples.
CheckAnalyzeVerOnTable checks whether the given version is the one from the tbl.
CheckEmptyTopNs checks whether all TopNs are empty.
CMSketchAndTopNFromProto converts CMSketch and TopN from its protobuf representation.
CMSketchToProto converts CMSketch to its protobuf representation.
ColAndIdxExistenceMapIsEqual is used in testing, checking whether the two are equal.
ColumnStatsIsInvalid checks if this column is invalid.
CopySampleItems returns a deep copy of SampleItem slice.
DebugTraceBuckets is used to trace the buckets used in the histogram.
DecodeCMSketch encodes the given CMSketch to byte slice.
DecodeCMSketchAndTopN decode a CMSketch from the given byte slice.
DecodeFMSketch decode a FMSketch from the given byte slice.
DecodeTopN decodes a TopN from the given byte slice.
DeepSlice sallowly clones a slice.
EmptyColumn creates an empty column object.
EncodeCMSketchWithoutTopN encodes the given CMSketch to byte slice.
EncodeFMSketch encodes the given FMSketch to byte slice.
EnumRangeValues generates enum values between low and high.
FMSketchFromProto converts FMSketch from its protobuf representation.
FMSketchToProto converts FMSketch to its protobuf representation.
GetIndexPrefixLens returns an array representing.
GetMergedTopNFromSortedSlice returns merged topn.
HistogramEqual tests if two histograms are equal.
HistogramFromProto converts Histogram from its protobuf representation.
HistogramToProto converts Histogram to its protobuf representation.
IndexStatsIsInvalid checks whether the index has valid stats or not.
MergeHistograms merges two histograms.
MergePartitionHist2GlobalHist merges hists (partition-level Histogram) to a global-level Histogram.
MergeTopN is used to merge more TopN structures to generate a new TopN struct by the given size.
MergeTopNAndUpdateCMSketch merges the src TopN into the dst, and spilled values will be inserted into the CMSketch.
NewBernoulliRowSampleCollector creates the new collector by the given inputs.
NewCMSketch returns a new CM sketch.
NewCMSketchAndTopN returns a new CM sketch with TopN elements, the estimate NDV and the scale ratio.
NewColAndIndexExistenceMap return a new object with the given capcity.
NewColAndIndexExistenceMapWithoutSize return a new object with default capacity.
NewDatumMapCache creates a new DatumMapCache.
NewExtendedStatsColl allocate an ExtendedStatsColl struct.
NewFMSketch returns a new FM sketch.
NewHistColl creates a new HistColl.
NewHistCollWithColsAndIdxs creates a new HistColl with given columns and indices.
NewHistogram creates a new histogram.
NewReservoirRowSampleCollector creates the new collector by the given inputs.
NewRowSampleCollector creates a collector from the given inputs.
NewSortedBuilder creates a new SortedBuilder.
NewStatsAllEvictedStatus returns the status that only loads count/nullCount/NDV and doesn't load CMSketch/TopN/Histogram.
NewStatsFullLoadStatus returns the status that the column/index fully loaded.
NewTopN creates the new TopN struct by the given size.
PseudoTable creates a pseudo table statistics.
QueryValue is used to query the count of specified value.
RowSamplesToProto converts the samp slice to the pb struct.
RowToDatums converts row to datum slice.
SampleCollectorFromProto converts SampleCollector from its protobuf representation.
SampleCollectorToProto converts SampleCollector to its protobuf representation.
SortTopnMeta sort topnMeta.
TopNFromProto converts TopN from its protobuf representation.
TopnMetaCompare compare topnMeta.
TraceStatsTbl converts a Table to StatsTblTraceInfo, which is suitable for the debug trace.
ValueToString converts a possible encoded value to a formatted string.

# Constants

AllEvicted indicates all statistics are evicted.
AllLoaded indicates all statistics are loaded.
AnalyzeFailed means the analyze job has failed.
AnalyzeFinished means the analyze job has finished.
AnalyzeFlag is set when the statistics comes from analyze.
AnalyzePending means the analyze job is pending.
AnalyzeRunning means the analyze job is running.
EmptyBucketSize is the size of empty bucket, 3*8=24 now.
EmptyHistogramSize is the size of empty histogram, about 112 = 8*6 for int64 & float64, 24*2 for arrays, 8*2 for references.
EmptyReservoirSampleItemSize = (24 + 16 + 8) now.
EmptySampleItemSize is the size of empty SampleItem, 96 = 72 (datum) + 8 (int) + 16.
EmptyScalarSize is the size of empty scalar.
ExtendedStatsAnalyzed is the status for extended stats which have been collected in analyze.
ExtendedStatsDeleted is the status for extended stats which were dropped.
ExtendedStatsInited is the status for extended stats which are just registered but have not been analyzed yet.
GlobalStatsMergeJob means the job is to merge the global-level stats.
MaxSampleValueLength defines the max length of the useful samples.
MaxSketchSize is the maximum size of the hashset in the FM sketch.
NonPartitionTableID is the partition id for non-partition table.
PseudoRowCount export for other pkg to use.
PseudoVersion means the pseudo statistics version is 0.
TableAnalysisJob means the job is to analyze a table or partition.
Version0 is the state that no statistics is actually collected, only the meta info.(the total count and the average col size).
Version1 maintains the statistics in the following way.
Version2 maintains the statistics in the following way.

# Variables

AutoAnalyzeMinCnt means if the count of table is less than this value, we don't need to do auto analyze.
ErrQueryInterrupted indicates interrupted.
GetRowCountByColumnRanges is a function type to get row count by column ranges.
GetRowCountByIndexRanges is a function type to get row count by index ranges.
GetRowCountByIntColumnRanges is a function type to get row count by int column ranges.
PrepareCols4MVIndex helps to identify the columns of an MV index.
RatioOfPseudoEstimate means if modifyCount / statsTblCount is greater than this ratio, we think the stats is invalid and use pseudo estimation.
UTCWithAllowInvalidDateCtx is introduced for the following reason: Invalid date values may be inserted into table under some relaxed sql mode.

# Structs

AnalyzeJob is used to represent the status of one analyze job.
AnalyzeProgress represents the process of one analyze job.
AnalyzeResult is used to represent analyze result.
AnalyzeResults represents the analyze results of a task.
AnalyzeTableID is hybrid table id used to analyze table.
BernoulliRowSampleCollector collects the samples from the source and organize the sample by row.
Bucket store the bucket count and repeat.
CMSketch is used to estimate point queries.
ColAndIdxExistenceMap is the meta map for statistics.Table.
Column represents a column histogram.
ColumnMemUsage records column memory usage.
DatumMapCache is used to store the mapping from the string type to datum type.
ExtendedStatsColl is a collection of cached items for mysql.stats_extended records.
ExtendedStatsItem is the cached item of a mysql.stats_extended record.
FMSketch (Flajolet-Martin Sketch) is a probabilistic data structure that estimates the count of unique elements in a stream.
HistColl is a collection of histograms.
Histogram represents statistics for a column or index.
Index represents an index histogram.
IndexMemUsage records index memory usage.
ReservoirRowSampleCollector collects the samples from the source and organize the samples by row.
ReservoirRowSampleItem is the item for the ReservoirRowSampleCollector.
RowSampleBuilder is used to construct the ReservoirRowSampleCollector to get the samples.
SampleBuilder is used to build samples for columns.
SampleCollector will collect Samples and calculate the count and ndv of an attribute.
SampleItem is an item of sampled column value.
SortedBuilder is used to build histograms for PK and index.
StatsLoadedStatus indicates the status of statistics.
StatsTblTraceInfo is simplified from Table and used for debug trace.
Table represents statistics for a table.
TableMemoryUsage records tbl memory usage.
TopN stores most-common values, which is used to estimate point queries.
TopNMeta stores the unit of the TopN.

# Interfaces

CacheItemMemoryUsage indicates the memory usage of TableCacheItem.
RowSampleCollector implements the needed interface for a row-based sample collector.
TableCacheItem indicates the unit item stored in statsCache, eg: Column/Index.

# Type aliases

JobType is the type of the analyze job.
WeightedRowSampleHeap implements the Heap interface.