If I disable automatic analyze table, besides manually running analyze table, I remember there is a parameter that prevents the execution plan from changing even if the statistics are outdated

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

Original topic: 如果我关闭自动analyze table 除了我手动analyze table 我记得还有个参数是让sql 哪怕统计信息过期也不改变执行计划的

| username: 芮芮是产品

[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version]
[Reproduction Path] What operations were performed that caused the issue
[Encountered Issue: Issue Phenomenon and Impact]
[Resource Configuration] Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachments: Screenshots/Logs/Monitoring]
If I disable automatic analyze table, besides manually analyzing the table, I remember there is a parameter that allows SQL to not change the execution plan even if the statistics are outdated.
Question 1: How to configure it
Question 2: If the statistics are outdated and it still uses the old plan instead of pseudo, will the performance be better?

| username: 芮芮是产品 | Original post link

One is binding, the other is lock stats.

| username: 春风十里 | Original post link

Whether binding or locking, there are risks. If the data volume changes significantly, using old statistics may lead to performance issues, so caution is advised.
Execution Plan Management (SPM) | PingCAP Archive Documentation

LOCK STATS | PingCAP Archive Documentation

| username: 小龙虾爱大龙虾 | Original post link

Are you referring to this 系统变量 | PingCAP 文档中心?

| username: Kongdom | Original post link

:yum: We have now added a scheduled task in the program to repeatedly execute ANALYZE TABLE xxx.

| username: tidb狂热爱好者 | Original post link

Yes, running a scheduled task is also a method.

| username: Jellybean | Original post link

+1
After using it for a while, we regularly execute analyze on some key tables during off-peak business hours. We’ve learned from past mistakes and pitfalls.

| username: dba远航 | Original post link

Binding (SPM) or solidifying statistics