There’s an UPDATE_TIME
column in the TABLES
table in the information_schema
database.
So you can try to get the max from that column with e.g.:
SELECT MAX(`UPDATE_TIME`)
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = 'dbname'
where we replace 'dbname'
with the corresponding database name.
More related info here on SO.
From the MySQL 5.7 docs:
UPDATE_TIME
displays a timestamp value for the lastUPDATE
,INSERT
, or
DELETE
performed onInnoDB
tables that are not partitioned. For MVCC,
the timestamp value reflects theCOMMIT
time, which is considered the
last update time. Timestamps are not persisted when the server is
restarted or when the table is evicted from the InnoDB data dictionary
cache.The
UPDATE_TIME
column also shows this information for partitioned
InnoDB
tables.
There seems to have been a bug, that UPDATE_TIME
wasn’t updated for InnoDB tables in MySQL <= 5.6, but should be fixed for 5.7+