What are the metrics for TiDB executing GC?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: TiDB执行GC的度量是什么

| username: alfred

To improve efficiency, please provide the following information. Clear problem descriptions can be resolved faster:
【TiDB Usage Environment】

【Overview】 Scenario + Problem Overview

【Background】 Operations performed

【Phenomenon】 Business and database phenomena

【Problem】 Current issue encountered

【Business Impact】

【TiDB Version】

【Application Software and Version】

【Attachments】 Relevant logs and configuration information

  • TiUP Cluster Display information
  • TiUP Cluster Edit config information

Monitoring (https://metricstool.pingcap.com/)

  • TiDB-Overview Grafana monitoring
  • TiDB Grafana monitoring
  • TiKV Grafana monitoring
  • PD Grafana monitoring
  • Corresponding module logs (including logs from 1 hour before and after the issue)

If the question is related to performance optimization or troubleshooting, please download the script and run it. Please select all and copy-paste the terminal output results for upload.

| username: ddhe9527 | Original post link

The main system variables that control this are as follows:

  • tidb_gc_run_interval: The interval at which GC is triggered, default value is 10 minutes.
  • tidb_gc_life_time: The data retention period for GC, default value is 10 minutes, and it cannot be set to less than 10 minutes. In the absence of long transactions, the Safe Point is the timestamp of the current time minus this duration.
| username: cs58_dba | Original post link

It is generally at the minute level, and it is also to ensure data recovery at the first opportunity.

| username: alfred | Original post link

That is to say, by default, only 10 minutes of old version data is retained, except for long-running transactions. How can I query how many versions of data are retained for a table?

| username: ddhe9527 | Original post link

From the TiDB perspective, it seems that there is no mention of being able to check how many versions are retained. You might need to seek in the write CF in RocksDB.

| username: alfred | Original post link

write cf and default cf

| username: system | Original post link

This topic will be automatically closed 60 days after the last reply. No new replies are allowed.