I have a lot of tables in my database, almost 1,000. Most of them I am not using now.
Is there any way to know from the information schema tables when I have last used my tables?
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It only takes a minute to sign up.Sign up to join this community
No, that information is not available on
INFORMATION_SCHEMA (it only stores metadata).
There are several options that I can recommend you:
long_query_time = 0(be careful of the extra overhead and disk space and then analyze per table used, so you can detect the last time it was used. Tools like
pt-query-digest --reviewaggregate by query, not by table, but they may be useful to look for specific queries.
All of them will tell you information since the point you activate them, and not past information. UNIX atime is very unreliable for access time, but you may also want to give that a try, depending on the engine.