MySQL last table alteration time
dave at thesmithfam.org
Wed Mar 28 10:15:16 MDT 2007
Brandon Stout wrote:
> Steve wrote:
>> I don't believe a table has any concept of a time unless one of 2
>> things is present.
>> #1 A timestamp field is appended to the table
>> #2 Logging is enabled.
>> If #2 is true you don't actually query the table, you query the log.
>> If #1 is true then you can set the timestamp field to update
>> automatically each time there is an update or insert command (using a
>> trigger, although IIRC this should be an automatic trigger)
> Note that triggers are supported in MySQL 5+. If you have a previous
> version, you cannot use triggers.
I ended up creating a TableTimestamps table and added triggers to the
tables I care about to update each table's last modified time in
TableTimestamps. Looks to be working great. This database is mostly
read, with few writes, so it ought to be good performance wise too.
More information about the PLUG