Sajeeva Lakmal
Sajeeva Lakmal

Reputation: 197

How to flush performance_schema stats without restarting MySQL?

I know stats in performance schema are not persistent over MySQL restarts. I want to flush all stats without restarting MySQL. Is there any way to do it?

Thanks.

Upvotes: 12

Views: 9187

Answers (2)

Michel
Michel

Reputation: 186

Easier then truncating each separate table would be to call the procedure:

CALL sys.ps_truncate_all_tables(FALSE);

MySQL 5.7 Reference Manual

Upvotes: 14

Marc Alff
Marc Alff

Reputation: 8395

TRUNCATE TABLE can be used to reset statistics.

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

Summary tables can be truncated with TRUNCATE TABLE. Generally, the effect is to reset the summary columns to 0 or NULL, not to remove rows. This enables you to clear collected values and restart aggregation.

Upvotes: 3

Related Questions