user690182 user690182 - 2 years ago 92
MySQL Question

MySQL: How can I get the timestamp of the last insertion to the database

How can I check when was the last time (timestamp) that I wrote in the database, irrespectively of the database table that I inserted into?

Answer Source

I wasn't able to use information_schema.tables update_time as the column wasn't being updated but for create_time this worked. It would work for update_time (if changed) if update_time gets updated which might be true in your setup.

select table_schema,table_name,max_time from information_schema.tables t1 JOIN 
 (select MAX(t2.create_time) AS max_time FROM 
  information_schema.tables t2 where  
  table_schema ='test') as t3  
on t1.create_time = t3.max_time;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download