# Composition of statistics

![`smart`](CompositionofStatistics_aa_001_20231012.png)

----------------------------------------------------
The richness of statistical data, coupled with a higher sampling rate and increased update frequency, provides a superior evaluative foundation for the optimizer, enhancing the likelihood of generating an optimal execution plan. The accompanying table can be used to illustrate the typical components of statistical information.

Statistics are generally categorized into two levels: table-level and column-level.

- Table-Level Statistics include the total number of rows in the table (estimated) and the count of rows modified since the last statistics collection.
- Column-Level Statistics are more detailed, encompassing histograms, `Count-Min Sketch`, `Top-N` (which represents values or indexes with the highest frequencies), the distribution and count of distinct values, and the number of null values, among other data points.

While collecting extensive data for each column may seem challenging for the TiDB Server's cache, in standard production environments, we employ sampling techniques to gather statistics. Here, the sampling rate significantly influences the quality of the statistics. Let's further explore some commonly used column-level statistical data.