15

How do you find out the last time a MySQL database was read or written to?

Can you even do that check per table?

Neil
  • 24,551
  • 15
  • 60
  • 81

3 Answers3

14
SELECT UPDATE_TIME
FROM   INFORMATION_SCHEMA.TABLES
WHERE  TABLE_SCHEMA = 'dbname'
AND    TABLE_NAME = 'tabname'

Source: How can I tell when a MySQL table was last updated?

Community
  • 1
  • 1
lecodesportif
  • 10,737
  • 9
  • 38
  • 58
4

If your database has bin logs switched on, you can get the last update time using mysqlbinlog.

If your database has query logging enabled, you can get the last query time (either updates or selects) by tailing the query log.

Martin
  • 9,674
  • 5
  • 36
  • 36
-1

check out command SHOW TABLE STATUS;
example: SHOW TABLE STATUS WHERE name="table_name_here", you need value from column Update_time

antony
  • 162
  • 2
  • 10