Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 252
Sajeeva Lakmal Avatar asked Mar 13 '17 07:03

Sajeeva Lakmal


2 Answers

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

CALL sys.ps_truncate_all_tables(FALSE);

MySQL 5.7 Reference Manual

like image 155
Michel Avatar answered Nov 09 '22 10:11

Michel


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.

like image 2
Marc Alff Avatar answered Nov 09 '22 09:11

Marc Alff