持续执行ANALYZE TABLE好几天

对于 GC 来说,分版本,高版本有个 max-gc-wait-time 之类的系统变量,低版本会等 24h 之后干掉那个事务(hard code),高版本因为这个变量干掉 txn 的时间可变。

https://github.com/pingcap/tidb/pull/32726/files

对于 analyze 来说,分版本,低版本是取 maxUint64 做 txn start_ts 忽略 txn 影响,但高版本选择了 snapshot 方式进行 analyze,会受到 txn 影响。

问题是 : analyze 会阻塞gc嘛?
首先,要看是什么版本,下面采用了什么机制,假设 max-gc-wait-time 设置无限长,同时 analyze 无限长时间跑不完,同时 analyze 又是取 snapshot 的方式,那么是会影响。需要具体问题,具体版本,具体分析。

总结来说,是否阻塞 GC 与 txn 有关,analyze 又与 txn 有关。