In MySQL, you can use the information_schema.tables table to determine when a table was last changed. The information_schema.tables table contains metadata about all tables in the database, including the timestamp of the last modification.
Here is an example of a query that you can use to find when a table was last changed:
Shell
1
2
3
SELECT table_name,update_time
FROM information_schema.tables
WHERE table_schema='mydatabase'ANDtable_name='mytable';
This query will return the name of the table and the timestamp of the last time the table was updated.
Alternatively, you can use the SHOW TABLE STATUS command, which also contains a Update_time column that shows when the table was last updated.
Shell
1
SHOW TABLE STATUS FROM mydatabase WHERE Name='mytable';
It's important to note that the update_time column in information_schema.tables table is updated every time there is any change to the table, including changes in the structure or data.
Also, it's important to note that these timestamps are only updated when the table is modified, they only give the time of the last modification and not when the last change was made on the table.
Open Source Database Systems Engineer with a deep understanding of Optimizer Internals, Performance Engineering, Scalability and Data SRE. Shiv currently is the Founder, Investor, Board Member and CEO of multiple Database Systems Infrastructure Operations companies in the Transaction Processing Computing and ColumnStores ecosystem. He is also a frequent speaker in open source software conferences globally.