How to clear MySQL query profiles

Ray picture Ray · Jan 20, 2014 · Viewed 9.9k times · Source

After turning on profiling in MySQL

  SET profiling=1;

I can run like a query like SELECT NOW(); and see profile results with it's execution time using:

  SHOW PROFILES;

However, I can't figure how to clear out the profile listing. Anyone know the statement to delete old profile data? SET profiling=0; just disables logging of new data and doesn't remove old stats.

Answer

Chris Blackwell picture Chris Blackwell · Sep 10, 2014

To remove previous query profiles set @@profiling_history_size=0. The following snippet clears the profiles, sets the history to its maximum size and enables profiling

SET @@profiling = 0;
SET @@profiling_history_size = 0;
SET @@profiling_history_size = 100; 
SET @@profiling = 1;

Tested on 5.6.17