Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not allow set tidb_auto_analyze_ratio to 0 #51582

Closed
Rustin170506 opened this issue Mar 7, 2024 · 2 comments · Fixed by #52190
Closed

Do not allow set tidb_auto_analyze_ratio to 0 #51582

Rustin170506 opened this issue Mar 7, 2024 · 2 comments · Fixed by #52190
Assignees
Labels
sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement.

Comments

@Rustin170506
Copy link
Member

Enhancement

Currently, if you set tidb_auto_analyze_ratio to 0, we will disable auto-analysis based on row changes, but we will still process the newly added indexes and tables.

This behavior is difficult to understand. I suppose most users will think 0 means we always need to analyze the table, no matter how many rows have been updated.

The historic reason we introduced it is that before #34643 this PR, there was no way to disable the auto-analyze feature without restarting the server. So we chose this special value to allow users to disable the auto-analysis feature. But now enable_tidb_auto_analyze is a global session variable. So we don't depend on this value.

So Roger and I suggest getting rid of this old behavior. No longer allow users to set it to zero.

However, I am not sure how to deal with the existing users' settings.

I think we have the following choices:

  1. Help users to set enable_tidb_auto_analyze to off if the user's tidb_anto_analyze_ratio is 0.
  2. Keep the old implementation and also keep the user's settings during the upgrade process. But we don't allow changing this value to 0 anymore.
@Rustin170506 Rustin170506 added type/enhancement The issue or PR belongs to an enhancement. sig/planner SIG: Planner labels Mar 7, 2024
@songrijie
Copy link

options 2 looks fine to me.

I believe the case setting tidb_anto_analyze_ratio to 0 is rare.

In addition, we can add extra comment in user doc of tidb_anto_analyze_ratio. If users want to completely disable auto analyze, go for enable_tidb_auto_analyze instead of setting tidb_anto_analyze_ratio to 0.

@Rustin170506
Copy link
Member Author

I am working on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants