I need to find out the last update time (or last changed time) of a table in the database (i.e. the last time when data in a specific table is updated, deleted or inserted) for deciding whether a backup is needed or not. As per the MySQL/MariaDB manual, I have used the following SQL statement to get the last modified time of a table in the database:
SELECT update_time FROM information_schema.tables WHERE table_schema='my_db' and table_name='my_table'; -- For table named 'my_table' in database 'my_db'
Here's the problem: The value of the resultant update_time
field is always returned NULL
even though changes are made in the specified table. What's more unanticipated is that when I manually browse the tables
table in the information_schema
database, there are no entry of my_db
and my_table
in table_schema
and table_name
fields respectively, meaning that the activities are not logged. Can someone please help me solve this problem and explain me the reason behind it?
EDIT:
This question is not a duplicate as the question also asks about the fields of information_schema.tables
being NULL
rather than just asking how to get last update time.