Bug #78773 sys: Record the last time that p_s was truncated
Submitted: 9 Oct 2015 8:09 Modified: 9 Oct 2015 10:49
Reporter: Simon Mudd (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: SYS Schema Severity:S4 (Feature request)
Version:1.5.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: performance_schema, sys

[9 Oct 2015 8:09] Simon Mudd
Description:
I collect data from sys periodically and then truncate the tables via sys.ps_truncate_all_tables  and currently there is no information on the time the tables are truncated.

So I have a local routine that records this timestamp in case I need to use it later.

How to repeat:
The performance_schema and sys views give you counters of things that have happened but in many cases there's no reference against _when_ this happened.  If you don't have that reference the values are "partly" useless.

My current "simple" solution is to have such a table and my collection script populates it as needed.

me@some-host [sys]> select * from sys.truncation_time;
+----+---------------------+
| id | last_update         |
+----+---------------------+
|  1 | 2015-10-09 10:05:06 |
+----+---------------------+
1 row in set (0.00 sec)

The id column can be ignored it's syntactic sugar which is not really necessary.

Suggested fix:
It would be useful if sys (or ideally performance_schema) had a way of allowing me to see when tables were truncated.  Initially I'd just like to record a single time when sys.ps_truncate_all_tables was last called as that gives me a good approximation.

Longer term having this information available for each table in performance_schema would be better.
[9 Oct 2015 10:49] Mark Leith
Thanks for the feature request, verifying.