# Controlling Statistics Gathering Behavior using Version

| Information                           | Version 1 | Version 2         |
| :------------------------------------ | :-------- | :---------------- |
| The total number of rows in the table | Collect   | Collect           |
| Column `Count-Min Sketch`             | Collect   | No Collect        |
| Index `Count-Min Sketch`              | Collect   | No Collect        |
| Column `Top-N`                        | Collect   | Collect(improved) |
| Index `Top-N`                         | Collect   | Collect(improved) |
| Column histogram                      | Collect   | Collect(improved) |
| Index histogram                       | Collect   | Collect(improved) |
| The number of NULLs in the column     | Collect   | Collect           |
| The number of NULLs in the index      | Collect   | Collect           |
| The average length of columns         | Collect   | Collect           |
| The average length of indexes         | Collect   | Collect           |

------------------------------------------------------------------------------
In discussing statistics gathering, we will explore various dimensions including versioning, methodology, timing, sampling, accuracy, and performance.

Currently, there are two versions of statistics information available. Version 2 statistics mitigates the significant errors that may arise from hash conflicts in larger datasets as seen in Version 1, while still maintaining estimated precision in most circumstances. From TiDB version 5.3.0 onward, Version 2 is the default.

Below is a comparison of the two versions, as detailed in the official TiDB database documentation: [TiDB Statistics Versions](https://docs.pingcap.com/tidb/stable/statistics#versions-of-statistics).