What is the correct behavior for column usage information when statistics are dropped?
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Enhancement
When we execute the 'drop stats' statement, it also clears the column usage information. This causes an issue because when users attempt to analyze the table again, there is no column usage information available.
https://github.com/pingcap/tidb/blob/aad3f7ad0f6219679d7be62703e6a70a08c95f7f/pkg/statistics/handle/storage/gc.go#L159
https://github.com/pingcap/tidb/blob/aad3f7ad0f6219679d7be62703e6a70a08c95f7f/pkg/executor/simple.go#L2752
We always collect column usage by default to help users analyze the table more effectively. Therefore, it would make sense to always keep the statistics and not clean them up when users drop other stats.
But if we change this behavior, then there is no way to clean up this information except to directly update the system table.
Contributor guide
Assessment
This issue has not been assessed yet.