public class Histogram extends Object
Each Histogram will have at most 256 buckets, each bucket contains a lower bound, a upper bound and the number of rows contain in such bound. With this information, SQL layer will be able to estimate how many rows will a index scan selects and determine which index to use will have the lowest cost.
Modifier and Type | Class and Description |
---|---|
static class |
Histogram.Builder |
Modifier and Type | Method and Description |
---|---|
List<Bucket> |
getBuckets() |
long |
getId() |
long |
getLastUpdateVersion() |
long |
getNullCount() |
long |
getNumberOfDistinctValue() |
double |
lessAndEqRowCount(Key values)
lessAndEqRowCount estimates the row count where the column less than or equal to value.
|
void |
mergeBlock(int bucketIdx)
mergeBuckets is used to merge every two neighbor buckets.
|
static Histogram.Builder |
newBuilder() |
String |
toString() |
double |
totalRowCount() |
public static Histogram.Builder newBuilder()
public long getNumberOfDistinctValue()
public long getNullCount()
public long getLastUpdateVersion()
public long getId()
public double lessAndEqRowCount(Key values)
public double totalRowCount()
public void mergeBlock(int bucketIdx)
bucketIdx:
- index of the last bucket.Copyright © 2024 PingCAP. All rights reserved.