匿名用户mysql中analyze table后,需要手动flush table ,让优化器重新加载新的统计信息吗?
mysql中analyze table后,需要手动flush table ,让优化器重新加载新的统计信息吗?
我来答
添加附件
收藏
分享
问题补充
4条回答
默认
最新
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
墨值悬赏
匿名用户mysql中analyze table后,需要手动flush table ,让优化器重新加载新的统计信息吗?
在 MySQL 中,执行 `ANALYZE TABLE` 后,通常不需要手动执行 `FLUSH TABLE` 来让优化器重新加载新的统计信息。
`ANALYZE TABLE` 命令本身会更新表的统计信息,优化器会在后续的查询中自动使用这些更新后的信息。
评论
有用 1官方的说明:
During the analysis, the table is locked with a read lock for InnoDB and MyISAM.
ANALYZE TABLE removes the table from the table definition cache, which requires a flush lock. If there are long running statements or transactions still using the table, subsequent statements and transactions must wait for those operations to finish before the flush lock is released. Because ANALYZE TABLE itself typically finishes quickly, it may not be apparent that delayed transactions or statements involving the same table are due to the remaining flush lock.
评论
有用 0
墨值悬赏