How to safely clear 'stats_mysql_query_digest'

1,252 views
Skip to first unread message

Michela

unread,
Feb 25, 2021, 8:32:48 PM2/25/21
to proxysql
Hello!

Might someone here be able to confirm for me how to properly clear the statistical data in 'stats_mysql_query_digest'?

Is a safe way to do this as simple as running 'DELETE * FROM stats_mysql_query_digest;' or similar?

An application we are using with ProxySQL has had significant changes to how it queries the database. So we want to have a fresh look at the statistics for it now.


Thank you for your help!
Michela

René Cannaò

unread,
Feb 25, 2021, 8:39:38 PM2/25/21
to Michela, proxysql
Hi Michela,

Statistics tables are read only, you can't delete them.
Nonetheless, for this purpose we have the _reset table : stats_mysql_query_digest_reset .
Querying stats_mysql_query_digest_reset will generate the table and also reset all the internal metrics.
So even a simple "SELECT 1 FROM stats_mysql_query_digest_reset LIMIT 1" will work.

In recent releases we also introduced "TRUNCATE TABLE stats_mysql_query_digest" .

--
You received this message because you are subscribed to the Google Groups "proxysql" group.
To unsubscribe from this group and stop receiving emails from it, send an email to proxysql+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/proxysql/014e8e4d-1af2-4ff7-a0c9-e05ec4b66f8en%40googlegroups.com.

Michela

unread,
Feb 25, 2021, 8:56:42 PM2/25/21
to proxysql
Hi, René,

'SELECT 1 FROM stats_mysql_query_digest_reset LIMIT 1;' did the trick!

I noticed that the '_reset' table also exists on 'stats_mysql_connection_pool', which is excellent.

We are running ProxySQL 2.1.0, so I imagine that the truncate table command would work in our case as well.


Thank you for the information, explanation behind it, and the very prompt reply!  :)

Best,
Michela
Reply all
Reply to author
Forward
0 new messages