0

Is there a way to query a MySQL table and get the last date when anything was done, either insert/update/delete was performed without querying the rows themselves? Or do I have to manually track that?

John
  • 9,840
  • 26
  • 91
  • 137
  • possible duplicate of [How can I tell when a MySQL table was last updated?](http://stackoverflow.com/questions/307438/how-can-i-tell-when-a-mysql-table-was-last-updated) – Matt Ball Oct 10 '11 at 22:03

2 Answers2

0

You have to manually track that. There are ways to get the query log, but is for administration.

For example, using your innodb binary log.

santiagobasulto
  • 11,320
  • 11
  • 64
  • 88
  • Not true. http://stackoverflow.com/questions/307438/how-can-i-tell-when-a-mysql-table-was-last-updated – Matt Ball Oct 10 '11 at 22:03
  • @MattBall You're right. Didn't know that. Anyway, i'd use that inside of a webapp, becouse you would have to allow access to information_schema, and would be a huge security risk. So, rewriting my answer: "for simplicity, you have to manually track that" – santiagobasulto Oct 10 '11 at 22:09
0

that's not something native to MySQL. Your options are either the binary log which only tracks committed changes or by turning on the general log and using that as a point of audit. The general log is extremely vebose - it will log everything, selects, updates, inserts and deletes and even if they're not successful or committed changes. The binary log would be my recommendations too.