暂无图片
mysql中analyze table后,需要手动flush table ,让优化器重新加载新的统计信息吗?
我来答
分享
暂无图片 匿名用户
mysql中analyze table后,需要手动flush table ,让优化器重新加载新的统计信息吗?

mysql中analyze table后,需要手动flush table ,让优化器重新加载新的统计信息吗?

我来答
添加附件
收藏
分享
问题补充
4条回答
默认
最新
chengang

不需要。

暂无图片 评论
暂无图片 有用 1
玄虚子

在 MySQL 中,执行 `ANALYZE TABLE` 后,通常不需要手动执行 `FLUSH TABLE` 来让优化器重新加载新的统计信息。 `ANALYZE TABLE` 命令本身会更新表的统计信息,优化器会在后续的查询中自动使用这些更新后的信息。

暂无图片 评论
暂无图片 有用 1
zy

官方的说明:

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
a

不需要。

手动执行FLUSH TABLE来使优化器重新加载新的统计信息。ANALYZE TABLE命令本身就会更新表的统计信息,并且这个更新通常是立即对查询优化器可见的。MySQL的查询优化器在生成执行计划时会自动使用最新的统计信息。

暂无图片 评论
暂无图片 有用 0
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
暂无图片墨值悬赏