0

Is there any way to know the time when last select statement has been performed on a table? I am using the InnoDB storage engine.

I have tried with the following query:

select update_time,table_name from information_schema.tables where table_schema='databasename'; 

..but I'm receiving NULL in the update_time column.

Brian Tompsett - 汤莱恩
  • 5,438
  • 68
  • 55
  • 126
Shabarinath Volam
  • 777
  • 4
  • 19
  • 46
  • select update_time,table_name from information_schema.tables where table_schema='databasename'; but if i try this iam getting null in update_time column – Shabarinath Volam Oct 08 '12 at 07:38
  • Edit your question and add the code there, as well as any comment you consider worth adding to clarify your question – Yaroslav Oct 08 '12 at 07:45

2 Answers2

0

Unless you manually update a last_accessed-field on the table, my best bet would be to add query logging and parse the log-files.

I googled and found these relates questions:

When was the last time a mysql table was accessed?

How do you get the last access (and/or write) time of a MySQL database?

Community
  • 1
  • 1
Morten Jensen
  • 5,555
  • 3
  • 41
  • 54
0

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

Himalaya Garg
  • 1,385
  • 16
  • 23