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

collect table statistics before renaming table #1418

Open
wangzihuacool opened this issue May 21, 2024 · 0 comments
Open

collect table statistics before renaming table #1418

wangzihuacool opened this issue May 21, 2024 · 0 comments

Comments

@wangzihuacool
Copy link
Contributor

wangzihuacool commented May 21, 2024

I encountered an extreme case last week. After alter table using gh-ost, the table statistics was not updated until half an hour later, causing a lot of slow queries.
The root cause of this issue is that the statistical event for this table was lost while being placed in the asynchronous queue waiting waiting to be consumed by background statistics update thread.

This may be an extreme case, but since the collection of statististics is performed asynchronously in the background, it is very likely that there will be situations where the statistics are not updated for a period of time after gh-ost modification, especially when there are a large number of tables in the database.

I wrote a script to test gh-ost schema changes thousands of times, and it often happens that the table's statistics were updated 2-3 seconds after gh-ost renames the table. I'm thinking if gh-ost could collect statistics once before renaming table, in order to avoid the issue of statistics not being updated in time after the schema change.

part of test info below:

                              table_name: sbtest1

    table_stats_last_update_time: 2024-05-19 02:07:06

    table_stats_last_update_rows: 134208

        gh_ost_table_create_time: 2024-05-19 10:47:47

        gh_ost_table_rename_time: 2024-05-19 10:47:56

              gh_ost_finish_time: 2024-05-19 10:47:47

  table_stats_after_gh_ost_finish_rows: 0

   table_stats_final_update_time: 2024-05-19 10:47:58

          table_stats_final_rows: 134208`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant