# Basic Statistics Synchronization Across TiDB Server Instances

+ When `stats_lease` expires, basic statistics will be updated automatically.
  
![`smart`](LoadStatistics04_aa_002_20231225.png)

------------------------------------------------------------------------------
The automatic updating process for statistics in the memory of TiDB Servers 1 and 2 involves a predefined lease term, referred to as `stats_lease`, within the TiDB database infrastructure. Upon the expiration of this lease, the most recent basic statistics—such as count, distinctCount, and nullCount—are propagated to other nodes. However, this update mechanism excludes memory-intensive statistics, including histograms, TopN, and Count-Min Sketch.

The official TiDB documentation provides a comprehensive explanation of this process:
+ For statistics that consume small amounts of memory (such as count, distinctCount, and nullCount), the corresponding statistics will be automatically loaded into memory for use in the SQL optimization stage as long as the column data is updated.
+ For statistics that consume large amounts of memory (such as histograms, TopN, and Count-Min Sketch), to ensure the performance of SQL execution, TiDB loads the statistics asynchronously on demand. Take histograms as an example. TiDB loads histogram statistics on a column into memory only when the optimizer uses the histogram statistics on that column. On-demand asynchronous statistics loading does not affect the performance of SQL execution but might provide incomplete statistics for SQL optimization.

For more information, please refer to the official documentation at: [TiDB Statistics Documentation](https://docs.pingcap.com/tidb/stable/statistics#load-statistics).