简体   繁体   English

如何在不重启MySQL的情况下刷新performance_schema统计信息?

[英]How to flush performance_schema stats without restarting MySQL?

I know stats in performance schema are not persistent over MySQL restarts. 我知道性能模式中的统计信息在MySQL重启时并不持久。 I want to flush all stats without restarting MySQL. 我想在不重启MySQL的情况下刷新所有统计数据。 Is there any way to do it? 有什么办法吗?

Thanks. 谢谢。

TRUNCATE TABLE can be used to reset statistics. TRUNCATE TABLE可用于重置统计信息。

See https://dev.mysql.com/doc/refman/5.7/en/performance-schema-table-characteristics.html 请参阅https://dev.mysql.com/doc/refman/5.7/en/performance-schema-table-characteristics.html

Summary tables can be truncated with TRUNCATE TABLE. 可以使用TRUNCATE TABLE截断摘要表。 Generally, the effect is to reset the summary columns to 0 or NULL, not to remove rows. 通常,效果是将摘要列重置为0或NULL,而不是删除行。 This enables you to clear collected values and restart aggregation. 这使您可以清除收集的值并重新启动聚合。

Easier then truncating each separate table would be to call the procedure: 更容易截断每个单独的表将调用该过程:

CALL sys.ps_truncate_all_tables(FALSE);

MySQL 5.7 Reference Manual MySQL 5.7参考手册

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM